Module: SimpleEnum::Accessors

Defined in:
lib/simple_enum/accessors.rb,
lib/simple_enum/accessors/accessor.rb,
lib/simple_enum/accessors/whiny_accessor.rb,
lib/simple_enum/accessors/ignore_accessor.rb

Defined Under Namespace

Classes: Accessor, IgnoreAccessor, WhinyAccessor

Constant Summary collapse

ACCESSORS =
{
  ignore: IgnoreAccessor,
  whiny:  WhinyAccessor
}

Class Method Summary collapse

Class Method Details

.accessor(name, enum, options = {}) ⇒ Object


12
13
14
15
16
# File 'lib/simple_enum/accessors.rb', line 12

def self.accessor(name, enum, options = {})
  access = options.fetch(:accessor, SimpleEnum.accessor)
  klass = ACCESSORS[access] || Accessor
  klass.new(name, enum, options[:source], options[:prefix])
end