Created
May 1, 2012 15:57
Revisions
-
edmore revised this gist
May 1, 2012 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -19,14 +19,14 @@ def initialize end end # Test our Setters superduperdev = Developer.new do |d| d.level = "journeyman" d.name = "Edmore" d.surname = "Moyo" end # Test our Getters ################################################ # 1.9.3p125 :031 > superduperdev.name # => "Edmore" -
edmore revised this gist
May 1, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,7 +15,7 @@ class Developer my_attr_accessor :level, :name, :surname def initialize yield ( self ) if block_given? end end -
edmore revised this gist
May 1, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,7 +20,7 @@ def initialize end # Setters superduperdev = Developer.new do |d| d.level = "journeyman" d.name = "Edmore" d.surname = "Moyo" -
edmore revised this gist
May 1, 2012 . 1 changed file with 8 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -28,14 +28,14 @@ def initialize # Getters ################################################ # 1.9.3p125 :031 > superduperdev.name # => "Edmore" # Edmore's IRB > superduperdev.surname # => "Moyo" # Edmore's IRB > superduperdev.level # => "journeyman" # Edmore's IRB > superduperdev.instance_variables # => [:@level, :@name, :@surname] ################################################ -
edmore revised this gist
May 1, 2012 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -26,7 +26,8 @@ def initialize d.surname = "Moyo" end # Getters ################################################ 1.9.3p125 :031 > superduperdev.name => "Edmore" Edmore's IRB > superduperdev.surname @@ -36,4 +37,5 @@ def initialize Edmore's IRB > superduperdev.instance_variables => [:@level, :@name, :@surname] ################################################ -
edmore revised this gist
May 1, 2012 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ class Object def self.my_attr_accessor( *names ) names.each do |name| define_method( "#{name}=" ) do |value| instance_variable_set( "@#{name}", value ) @@ -12,7 +12,7 @@ def self.my_attr_accessible( *names ) end class Developer my_attr_accessor :level, :name, :surname def initialize yield (self) if block_given? -
edmore created this gist
May 1, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ class Object def self.my_attr_accessible( *names ) names.each do |name| define_method( "#{name}=" ) do |value| instance_variable_set( "@#{name}", value ) end define_method( name ) do instance_variable_get( "@#{name}" ) end end end end class Developer my_attr_accessible :level, :name, :surname def initialize yield (self) if block_given? end end # Setters superduperdev = Developer.new() do |d| d.level = "journeyman" d.name = "Edmore" d.surname = "Moyo" end # Getters 1.9.3p125 :031 > superduperdev.name => "Edmore" Edmore's IRB > superduperdev.surname => "Moyo" Edmore's IRB > superduperdev.level => "journeyman" Edmore's IRB > superduperdev.instance_variables => [:@level, :@name, :@surname]