Skip to content

Instantly share code, notes, and snippets.

@adhusson
Created October 1, 2009 20:25
Show Gist options
  • Save adhusson/199218 to your computer and use it in GitHub Desktop.
Save adhusson/199218 to your computer and use it in GitHub Desktop.
class Animal
attr_reader :name, :color
def initialize(name,color)
@name = name
@color = color
end
def self.create_felix(color)
# Is this how I should refer to the newly created instance of Animal?
this = self.new("common",color)
p this.color
end
end
red_felix = Animal.create_felix("red")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment