Revisions
-
rfletcher revised this gist
Feb 3, 2011 . 1 changed file with 3 additions and 4 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 @@ -6,11 +6,10 @@ def initialize() end def to_hash self.instance_variables.inject({}) do |a, e| a[e[1..-1].to_sym] = self.instance_variable_get(e) a end end end -
wmw revised this gist
Feb 2, 2011 . 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 @@ -1,6 +1,6 @@ class Balls def initialize() @name = 'blah' @caption = 'blah' end -
wmw created this gist
Feb 2, 2011 .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,16 @@ class Balls def initialize(outfit) @name = 'blah' @caption = 'blah' end def to_hash hash = self.instance_variables.inject({}) do |a, e| hash = {e[1..-1] => self.instance_variable_get(e)} a.merge(hash) end hash.symbolize_keys! end end