Skip to content

Commit

Permalink
add to_hash
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmcconnell committed Jan 26, 2015
1 parent fa604d7 commit 07d8c74
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/attr_init.rb
Expand Up @@ -36,8 +36,10 @@ def fattr_init(params)

def fattr_hash(*attrs)
class_eval do
self.class.fattrs.each_with_object({}) do |key, hash|
hash[key] = send key
def to_hash
self.class.fattrs.each_with_object({}) do |key, hash|
hash[key] = send key
end
end
end
end
Expand Down

0 comments on commit 07d8c74

Please sign in to comment.