Module: EnumeratedAttribute::Attribute

Defined in:
lib/enumerated_attribute/attribute.rb,
lib/enumerated_attribute/attribute/attribute_descriptor.rb

Defined Under Namespace

Classes: AttributeDescriptor

Class Method Summary collapse

Class Method Details

.define_enumerated_attribute_custom_method(symbol, attr_name, value, negated) ⇒ Object



233
234
235
236
237
238
# File 'lib/enumerated_attribute/attribute.rb', line 233

def self.define_enumerated_attribute_custom_method(symbol, attr_name, value, negated)
  define_method symbol do
    ival = read_enumerated_attribute(attr_name)
    negated ? ival != value : ival == value
  end
end