Module: EacRubyUtils::Immutable::ClassMethods

Defined in:
lib/eac_ruby_utils/immutable/class_methods.rb

Instance Method Summary collapse

Instance Method Details

#immutable_accessor(*accessors) ⇒ Object


6
7
8
9
10
11
12
13
# File 'lib/eac_ruby_utils/immutable/class_methods.rb', line 6

def immutable_accessor(*accessors)
  options = accessors.extract_options!
  options[:type] ||= const_get('TYPE_COMMON')
  accessors.each do |name|
    class_name = options.fetch(:type).to_s.camelize + 'Accessor'
    ::EacRubyUtils::Immutable.const_get(class_name).new(name).apply(self)
  end
end