module ActiveEvent::Support::AttrSetter

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

Public Instance Methods

init_attributes(attributes) click to toggle source

override to skip the freezing!

# File lib/active_event/support/attr_setter.rb, line 17
def init_attributes(attributes)
  self.attributes = attributes.symbolize_keys
end