Skip to content

Instantly share code, notes, and snippets.

@ajmalafif
Last active October 11, 2015 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajmalafif/3867443 to your computer and use it in GitHub Desktop.
Save ajmalafif/3867443 to your computer and use it in GitHub Desktop.
[ruby] - Classes, initialize method, instance variable
# http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_classes.html
class Learn
def initialize(*arguments)
@var1, @var2 = arguments
end
def method
"#{@var1} #{@var2}"
end
end
a = Learn.new("test1", "test2")
puts a.inspect
puts a.method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment