Skip to content

Instantly share code, notes, and snippets.

@LewisYoul
Created September 18, 2017 11:23
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 LewisYoul/b95e0cc1adbe47616089fa4652f8b2d3 to your computer and use it in GitHub Desktop.
Save LewisYoul/b95e0cc1adbe47616089fa4652f8b2d3 to your computer and use it in GitHub Desktop.
Class Example 1
class Dog
attr_accessor :name, :breed, :age
def initialize (name, breed, age)
@name = name
@breed = breed
@age = age
end
def bark
puts "BARK BARK BARK!"
end
end
lewis = Dog.new "Lewis","Dalmation",28
puts lewis.inspect
#<Dog:0x00556757f99138 @name="Lewis", @breed="Dalmation", @age=28>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment