Class: GraphqlRails::Attributes::Attribute
- Inherits:
-
Object
- Object
- GraphqlRails::Attributes::Attribute
- Includes:
- Attributable, AttributeConfigurable, InputConfigurable
- Defined in:
- lib/graphql_rails/attributes/attribute.rb
Overview
contains info about single graphql attribute
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
- #field_args ⇒ Object
- #field_options ⇒ Object
-
#initialize(name) ⇒ Attribute
constructor
A new instance of Attribute.
Methods included from InputConfigurable
#build_input_attribute, #input_attribute_options, #paginated, #paginated?, #pagination_options, #permit, #permit_input
Methods included from AttributeConfigurable
#deprecated, #deprecation_reason, #group, #groups, #hidden_in_groups, #optional, #property, #required, #same_as
Methods included from Attributable
#field_name, #graphql_model, #initialize_copy, #name, #optional?, #required?, #scalar_type?, #type_name
Constructor Details
#initialize(name) ⇒ Attribute
Returns a new instance of Attribute.
18 19 20 21 22 |
# File 'lib/graphql_rails/attributes/attribute.rb', line 18 def initialize(name) @initial_name = name @property = name.to_s @attributes ||= {} end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
16 17 18 |
# File 'lib/graphql_rails/attributes/attribute.rb', line 16 def attributes @attributes end |
Instance Method Details
#field_args ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/graphql_rails/attributes/attribute.rb', line 24 def field_args [ field_name, type_parser.type_arg, description, * ].compact end |
#field_options ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/graphql_rails/attributes/attribute.rb', line 33 def { method: property.to_sym, null: optional?, camelize: camelize?, groups: groups, hidden_in_groups: hidden_in_groups, **deprecation_reason_params, ** } end |