🌱 Ruby Stuff
Modules are included once per program. Modules are get required.
Classes allow for many objects to be built from them. Classes get initiated.
$
means global
@
means object
# dict style
mystuff['apples']
# module style
MyStuff.apples()
puts MyStuff::TANGERINE
# class style
thing = MyStuff.new()
thing.apples()
puts thing.tangerine
class X(Y) “Make a class named X that is-a Y.” class X(object): def initialize(J) “class X has-a initialize that takes a J parameter.” class X(object): def M(J) “class X has-a function named M that takes a J parameter.” foo = X() “Set foo to an instance of class X.” foo.M(J) “From foo get the M function, and call it with parameter J.” foo.K = Q “From foo get the K attribute and set it to Q.”
Programming Ruby: The Pragmatic Programmer’s Guide http://ruby-doc.com/docs/ProgrammingRuby/
Learn Code The Hard Way — Books And Courses To Learn To Code http://learnrubythehardway.org
Learn Ruby with the Neo Ruby Koans http://rubykoans.comg