1. Trang chủ
  2. » Công Nghệ Thông Tin

Ruby for Rails phần 1 pps

50 366 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 50
Dung lượng 4,24 MB

Nội dung

[...]... 11 0 Sending messages to objects with the send method 11 1 4.3 Required, optional, and default-valued arguments 11 2 Required and optional arguments 11 2 Default values for arguments 11 3 Order of arguments 11 4 ■ ■ 4.4 Local variables and variable assignment 11 5 Variable assignment in depth 11 7 Local variables and the things that look like them 11 9 ■ 4.5 5 Summary 12 0 Organizing objects with classes 12 1... Enumerables 306 11 .5 Sorting collections 12 Summary 304 307 Sorting and the Comparable module Defining sort order in a block 310 11 .6 303 309 311 Regular expressionsand regexp-basedstring operations 312 12 .1 What are regular expressions? A word to the regex-wise 314 ■ 313 A further word to everyone 314 CONTENTS 12 .2 Writing regular expressions 314 The regular expression literal constructor 315 Building... Class class 14 0 Classes are objects too! 14 0 When, and why, to write a class method 14 1 Class methods vs instance methods, clarified 14 3 The Class class and Class.new 14 4 ■ ■ 5.5 Constants up close 14 5 Basic usage of constants 14 5 modifying constants 14 6 ■ Reassigning vs xii CONTENTS 5.6 Inheritance 14 8 Inheritance and Rails engineering nurture in Ruby objects 15 1 5.7 6 Summary 14 9 Nature vs ■ 15 3 Modules... inheritance 17 1 in Rails source and boilerplate code 6.4 7 Summary ■ 17 0 Modular organization 17 3 17 6 The default object (self) and scope 17 7 7 .1 Understanding self, the current/default object 17 9 Who gets to be self, and where 17 9 Self as default receiver of messages 18 4 Instance variables and self 18 6 ■ ■ 7.2 Determining scope 18 8 Global scope and global variables 18 8 Scope and resolution of constants 19 4... presentation by David Heinemeier Hansson, the creator of Rails, at the 2004 International Ruby Conference Ruby for Rails sounds like it might mean “…as opposed to regular Ruby, ” a tool for dividing Ruby users into Rails and non -Rails camps I saw it as the opposite: real Ruby, regular Ruby, on its own terms, but studied primarily because of what it can do for Rails developers I was in a good position to understand... with classes 12 1 5 .1 Classes and instances A first class 5.2 12 3 Setter methods ■ 12 2 Instance variables and object state 12 6 13 0 The equal sign (=) in method names 13 1 ActiveRecord properties and other =-method applications 13 3 5.3 Attributes and the attr_* method family 13 6 Automating the creation of attribute handlers 13 7 Two (getter/ setter) for one 13 8 Summary of attr_* methods 13 9 ■ ■ 5.4 Class... arguments, revisited 268 10 .3 Numerical objects 270 Numerical classes 10 .4 Times and dates 272 10 .5 11 270 Summary ■ Performing arithmetic operations 2 71 275 Collections, containers, and enumerability 277 11 .1 Arrays and hashes compared 11 .2 Using arrays 278 279 Creating a new array 279 Inserting, retrieving, and removing array elements 280 Combining arrays with other arrays 283 Array transformations 285 Array... specifically for you, the Rails enthusiast who wants to do it right—will give you Ruby for Rails is a Ruby how-to book, more than a Rails how-to book That doesn’t mean you shouldn’t read Rails how-to books too But if you’re serious about Rails, you should learn at least as much Ruby as this book contains How Ruby can help you, in more detail A solid grounding in Ruby can serve you, as a Rails developer,... Part 1, “The Ruby/ Rails landscape” Part 2, Ruby building-blocks” and part 3, “Built-in classes and modules” Part 4, Rails through Ruby, Ruby through Rails The book takes a breadth-first approach to its topic(s) Part 1 provides an overview of the programming environment of Ruby and Rails This part includes a medium level of detail, but it’s detailed enough to include the creation of a working Rails. .. CONTENTS 1. 4 Anatomy of the Ruby programming environment 24 The layout of the Ruby source code 24 Navigating the Ruby installation 25 Important standard Ruby tools and applications 27 ■ ■ 1. 5 2 Summary 31 How Rails works 33 2 .1 Inside the Rails framework 34 A framework user’s–eye view of application development 35 Introducing the MVC framework concept 36 Meet MVC in the (virtual) flesh 37 2.2 Analyzing Rails . the send method 11 1 4.3 Required, optional, and default-valued arguments 11 2 Required and optional arguments 11 2 ■ Default values for arguments 11 3 ■ Order of arguments 11 4 4.4 Local variables. class="bi x0 y0 w0 h0" alt="" Ruby for Rails Ruby for Rails RUBY TECHNIQUES FOR RAILS DEVELOPERS DAVID A. BLACK MANNING Greenwich (74° w. long.) For online information and ordering of this. assignment 11 5 Variable assignment in depth 11 7 ■ Local variables and the things that look like them 11 9 4.5 Summary 12 0 5 Organizing objects with classes 12 1 5 .1 Classes and instances 12 2 A first

Ngày đăng: 06/08/2014, 09:20

TỪ KHÓA LIÊN QUAN

w