Mega Code Archive
Categories
/
Ruby
/
Class
Initializes the instance variable @name with the standard initialize method
class Horse def initialize( name ) @name = name end def horse_name @name end end horse = Horse.new( "Doc Bar" ) puts horse.horse_name # => Doc Bar