Module: Defaults::ClassMethods
- Defined in:
- lib/defaults.rb
Instance Method Summary collapse
Instance Method Details
#defaults(attrs) ⇒ Object
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/defaults.rb', line 42 def defaults(attrs) raise ArgumentError, "Hash expected; #{attrs.class} given." unless attrs.is_a?(Hash) include InstanceMethods self.default_values ||= {} self.default_values.merge!(attrs) after_initialize :set_default_attributes end |