Module: ActiveEvent::Support::AttrSetter
- Extended by:
- ActiveSupport::Concern
- Includes:
- AttrInitializer
- Included in:
- Command
- Defined in:
- lib/active_event/support/attr_setter.rb
Overview
Allows to initialize and set attributes with a hash
example:
class RgbColor
include ActiveEvent::AttrSetter
attributes :r, :g, :b
end
green = RgbColor.new r: 250, g: 20, b: 20
green.r = 255
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#init_attributes(attributes) ⇒ Object
override to skip the freezing!.
Methods included from AttrInitializer
#attributes_except, #freeze, #initialize, #to_hash
Instance Method Details
#init_attributes(attributes) ⇒ Object
override to skip the freezing!
16 17 18 |
# File 'lib/active_event/support/attr_setter.rb', line 16 def init_attributes(attributes) self.attributes = attributes.symbolize_keys end |