Class: GraphQL::Rails::ActiveReflection::AttributeReflection
- Inherits:
-
Object
- Object
- GraphQL::Rails::ActiveReflection::AttributeReflection
- Defined in:
- lib/graphql/rails/active_reflection/attribute_reflection.rb
Class Attribute Summary collapse
-
.schema_name ⇒ Object
Returns the value of attribute schema_name.
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#field_name ⇒ Object
readonly
Returns the value of attribute field_name.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#validators ⇒ Object
readonly
Returns the value of attribute validators.
Instance Method Summary collapse
-
#initialize(field, klass, schema) ⇒ AttributeReflection
constructor
A new instance of AttributeReflection.
Constructor Details
#initialize(field, klass, schema) ⇒ AttributeReflection
Returns a new instance of AttributeReflection.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/graphql/rails/active_reflection/attribute_reflection.rb', line 11 def initialize(field, klass, schema) @klass = klass @field_name = field.name @name = field.property || field.name @validators = klass.validators.map { |validator| # Skip if the validator does not apply to this field # Skip if there are :if or :unless options (conditionals purposely unsupported) next if validator.attributes.exclude?(@name.to_sym) || validator.[:if].present? || validator.[:unless].present? GraphQL::Rails::ActiveReflection::ValidatorReflection.new(validator) }.compact @errors = [] end |
Class Attribute Details
.schema_name ⇒ Object
Returns the value of attribute schema_name.
25 26 27 |
# File 'lib/graphql/rails/active_reflection/attribute_reflection.rb', line 25 def schema_name @schema_name end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
8 9 10 |
# File 'lib/graphql/rails/active_reflection/attribute_reflection.rb', line 8 def description @description end |
#field_name ⇒ Object (readonly)
Returns the value of attribute field_name.
7 8 9 |
# File 'lib/graphql/rails/active_reflection/attribute_reflection.rb', line 7 def field_name @field_name end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
5 6 7 |
# File 'lib/graphql/rails/active_reflection/attribute_reflection.rb', line 5 def klass @klass end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/graphql/rails/active_reflection/attribute_reflection.rb', line 6 def name @name end |
#validators ⇒ Object (readonly)
Returns the value of attribute validators.
9 10 11 |
# File 'lib/graphql/rails/active_reflection/attribute_reflection.rb', line 9 def validators @validators end |