Class: HQ::GraphQL::ObjectAssociation::ResourceReflection
- Inherits:
-
Object
- Object
- HQ::GraphQL::ObjectAssociation::ResourceReflection
- Defined in:
- lib/hq/graphql/object_association.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#macro ⇒ Object
readonly
Returns the value of attribute macro.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
Instance Method Summary collapse
-
#initialize(name, scope, options, macro, block) ⇒ ResourceReflection
constructor
A new instance of ResourceReflection.
- #reflection(model_klass) ⇒ Object
Constructor Details
#initialize(name, scope, options, macro, block) ⇒ ResourceReflection
36 37 38 39 40 41 42 |
# File 'lib/hq/graphql/object_association.rb', line 36 def initialize(name, scope, , macro, block) @name = name @scope = scope = @macro = macro @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
34 35 36 |
# File 'lib/hq/graphql/object_association.rb', line 34 def block @block end |
#macro ⇒ Object (readonly)
Returns the value of attribute macro.
34 35 36 |
# File 'lib/hq/graphql/object_association.rb', line 34 def macro @macro end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
34 35 36 |
# File 'lib/hq/graphql/object_association.rb', line 34 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
34 35 36 |
# File 'lib/hq/graphql/object_association.rb', line 34 def end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
34 35 36 |
# File 'lib/hq/graphql/object_association.rb', line 34 def scope @scope end |
Instance Method Details
#reflection(model_klass) ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/hq/graphql/object_association.rb', line 44 def reflection(model_klass) if macro == :has_many ::ActiveRecord::Associations::Builder::HasMany.create_reflection(model_klass, name, scope, ) elsif macro == :belongs_to ::ActiveRecord::Associations::Builder::BelongsTo.create_reflection(model_klass, name, scope, ) end end |