Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Ludomanager
- module ARMustache
- # any method placed here will apply to classes, like Hickwall
- def mustache_attrs(*attrs)
- cattr_accessor :mustache_attrs
- self.mustache_attrs = attrs
- send :include, InstanceMethods
- end
- module InstanceMethods
- # any method placed here will apply to instances, like @hickwall
- def to_mustache_attr
- self.mustache_attrs.inject({}) do |hash, attr|
- hash[attr] = self.send(attr)
- hash
- end
- end
- end
- end
- end
- ActiveRecord::Base.extend Ludomanager::ARMustache
Add Comment
Please, Sign In to add comment