bensie / rubyist.new Goto Github PK
View Code? Open in Web Editor NEWIntro to Ruby Class Slides & Class Files
Intro to Ruby Class Slides & Class Files
Here is my solution to yesterday's exercise:
https://gist.github.com/1014564
I want to clarify something that came up last night. Take the following example:
class Address
def initialize(options = {})
@street = options[:street]
end
end
Keep in mind that whenever there is an "=" as part of an argument list, it means that we're setting a default. In this case, if we initialize a new object without passing any arguments to Address.new()
, the variable options
will be set as any empty hash in the initializer. This in no way says that the options
argument must be a hash.
Let's say we skip setting the default value here:
class Address
def initialize(options)
@street = options[:street]
end
end
In this case, options
becomes a required argument and there is no default value. It could still very well be a hash, but we're just not providing a default.
In either case, options
can be passed to Address.new
as any type of object (string, integer, array, etc), but we're expecting a hash and operating under the assumption that we'll be getting a hash.
Feel free to post any questions here.
@tapatio, @jkussmann, @weblife, @CreamyGoodness, @derekwrobel
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.