Class: GraphQL::Models::ActiveRecordExtension::EnumTypeHash
- Inherits:
-
Object
- Object
- GraphQL::Models::ActiveRecordExtension::EnumTypeHash
- Extended by:
- Forwardable
- Defined in:
- lib/graphql/models/active_record_extension.rb
Instance Attribute Summary collapse
-
#hash ⇒ Object
Returns the value of attribute hash.
Instance Method Summary collapse
- #[](attribute) ⇒ Object
-
#initialize ⇒ EnumTypeHash
constructor
A new instance of EnumTypeHash.
Constructor Details
#initialize ⇒ EnumTypeHash
Returns a new instance of EnumTypeHash.
11 12 13 |
# File 'lib/graphql/models/active_record_extension.rb', line 11 def initialize @hash = {}.with_indifferent_access end |
Instance Attribute Details
#hash ⇒ Object
Returns the value of attribute hash.
9 10 11 |
# File 'lib/graphql/models/active_record_extension.rb', line 9 def hash @hash end |
Instance Method Details
#[](attribute) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/graphql/models/active_record_extension.rb', line 15 def [](attribute) type = hash[attribute] type = type.call if type.is_a?(Proc) type = type.constantize if type.is_a?(String) type end |