Module: Hashie::Extensions::Dash::PredefinedValues::ClassMethods

Defined in:
lib/hashie/extensions/dash/predefined_values.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#values_for_propertiesObject (readonly)

Returns the value of attribute values_for_properties.



25
26
27
# File 'lib/hashie/extensions/dash/predefined_values.rb', line 25

def values_for_properties
  @values_for_properties
end

Instance Method Details

#inherited(klass) ⇒ Object



27
28
29
30
# File 'lib/hashie/extensions/dash/predefined_values.rb', line 27

def inherited(klass)
  super
  klass.instance_variable_set(:@values_for_properties, values_for_properties.dup)
end

#property(property_name, options = {}) ⇒ Object



32
33
34
35
36
37
38
39
# File 'lib/hashie/extensions/dash/predefined_values.rb', line 32

def property(property_name, options = {})
  super

  return unless (predefined_values = options[:values])

  assert_predefined_values!(predefined_values)
  set_predefined_values(property_name, predefined_values)
end