Ruby for Rails phần 2 ppsx

Ruby for Rails phần 2 ppsx

Ruby for Rails phần 2 ppsx

... "show", Listing 2. 6 edition/show.rhtml , the template for the edition/show action Listing 2. 7 composer/show.rhtml , the template for the composer/show view 48 CHAPTER 2 How Rails works Writing the Rails ... in Ruby and shipped with Ruby) , lightTPD CGI Library CGI data processing routines Parses incoming form data Part of the Ruby standard library ERb "Em...

Ngày tải lên: 06/08/2014, 09:20

52 428 0
Ruby for Rails phần 10 ppsx

Ruby for Rails phần 10 ppsx

... with 20 verbose output from 29 0 iterators 21 9 22 4, 24 4 24 5 basics of yielding to a block 21 9 22 2 basis of for keyword in itera- tion with each 22 3 22 4 code block execution vs. return value of 24 5 code ... 21 9 yielding arguments to block 22 1 K Kernel#inspect 331 keywords 119, 20 8 20 9 alias 366 barewords interpreted as 119 break 21 6 case 21 2 class 123 , 155, 17...

Ngày tải lên: 06/08/2014, 09:20

53 379 0
Ruby for Rails phần 1 pps

Ruby for Rails phần 1 pps

... yield keyword 21 9 The basics of yielding to a block 21 9 ■ Performing multiple iterations 22 2 ■ Using different code blocks 22 3 More about for 22 3 8.4 Error handling and exceptions 22 5 Raising ... exceptions 22 5 ■ Raising exceptions explicitly 22 7 ■ Creating your own exception classes 22 8 8.5 Summary 23 0 PART 3BUILT-IN CLASSES AND MODULES 23 1 9 Built-in essen...

Ngày tải lên: 06/08/2014, 09:20

50 366 0
Ruby for Rails phần 3 pps

Ruby for Rails phần 3 pps

... definition 72 CHAPTER 3 Ruby- informed Rails development because of Ruby (Ruby doesn’t care), but because leaving the parentheses off is a standard Rails convention. The common idioms you use in Rails ... terms, for information about the event it’s for: when, where, name of event; performer; which seat; how much it costs. When asked, the ticket will provide the following in...

Ngày tải lên: 06/08/2014, 09:20

53 357 0
Ruby for Rails phần 4 pptx

Ruby for Rails phần 4 pptx

... system): Loading object 9 429 12 Loading object 9 428 92 Loading object 9 428 82 The first suitcase off the plane is 9 428 82 The cargo hold example shows how you can use an existing module for a new class. Sometimes ... class: class Temperature def Temperature.c2f(c) c * 9 / 5 + 32 end def Temperature.f2c(f) (f - 32) * 5 / 9 end end And let’s try it out: puts Temperature.c2f(100)...

Ngày tải lên: 06/08/2014, 09:20

55 286 0
Ruby for Rails phần 5 pdf

Ruby for Rails phần 5 pdf

... the same method to convert temperatures the other way: fahrens = [ 32, 62, 92, 122 ,1 52, 1 82, 2 12] temp_chart(fahrens) {|fahr| (fahr - 32) * 5 / 9 } temp_chart fires the values at the block and prints ... and exceptions 22 5 8.4 Error handling and exceptions Way back in chapter 1, we looked at how to test code for syntax errors: $ ruby -cw filename.rb Passing the -cw test means R...

Ngày tải lên: 06/08/2014, 09:20

55 352 0
Ruby for Rails phần 6 pdf

Ruby for Rails phần 6 pdf

... eight): >> 0 12 => 10 >> 0 12 + 12 => 22 >> 0 12 + 0x 12 => 28 You can also use the to_i method of strings to convert numbers in any base to decimal. To perform such a conversion, ... Rails sce- nario) are a doubly likely candidate for symbol usage. 10 .2. 2 Rails- style method arguments, revisited Symbols play a big role in the kind of programming-...

Ngày tải lên: 06/08/2014, 09:20

60 314 0
Ruby for Rails phần 7 doc

Ruby for Rails phần 7 doc

... listing 12. 1: The whole string we started with: My phone number is ( 123 ) 555- 123 4. The entire part of the string that matched: ( 123 ) 555- 123 4 The three captures: Capture #1: 123 Capture #2: 555 Capture ... of a Further regular expression techniques 323 Other MatchData information The code in listing 12. 2, which is designed to be grafted onto listing 12. 1, gives some quick exampl...

Ngày tải lên: 06/08/2014, 09:20

58 258 0
Ruby for Rails phần 8 pdf

Ruby for Rails phần 8 pdf

... arity. Ruby offers several variations on the callable method-or-function theme. We’ll look next at another form of anonymous function: the lambda. B Part 4 Rails through Ruby, Ruby through Rails The ... you get more out of Rails by knowing more about Ruby. The goals here are the goals of the book itself: ■ Learning the Ruby foundations of specific Rails techniques ■ Using y...

Ngày tải lên: 06/08/2014, 09:20

48 406 0
Ruby for Rails phần 9 pps

Ruby for Rails phần 9 pps

... the model and its associated entities for a next level of information. This information, in turn, might be used for in-house reports, richer on-screen information displays, or sales profiling. ... cosmetic. The consistent “Rubyness” of a Rails application makes for a consistent development experience: It’s easier to think in Ruby the whole time than it is to switch back and forth. (...

Ngày tải lên: 06/08/2014, 09:20

44 313 0
Từ khóa:
w