Module: ActiveGraph::Shared::Enum::ClassMethods
- Defined in:
- lib/active_graph/shared/enum.rb
Instance Attribute Summary collapse
-
#neo4j_enum_data ⇒ Object
readonly
Returns the value of attribute neo4j_enum_data.
Instance Method Summary collapse
-
#enum(**parameters) ⇒ Object
Similar to ActiveRecord enum, maps an integer value on the database to a set of enum keys.
Instance Attribute Details
#neo4j_enum_data ⇒ Object (readonly)
Returns the value of attribute neo4j_enum_data.
9 10 11 |
# File 'lib/active_graph/shared/enum.rb', line 9 def neo4j_enum_data @neo4j_enum_data end |
Instance Method Details
#enum(**parameters) ⇒ Object
Similar to ActiveRecord enum, maps an integer value on the database to a set of enum keys.
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/active_graph/shared/enum.rb', line 44 def enum(**parameters) , parameters = *(parameters) parameters.each do |property_name, enum_keys| enum_keys = normalize_key_list enum_keys, @neo4j_enum_data ||= {} @neo4j_enum_data[property_name] = enum_keys define_property(property_name, enum_keys, ) define_enum_methods(property_name, enum_keys, ) end end |