Class: GraphQLSchema::Field
Instance Method Summary
collapse
#deprecated?, #deprecation_reason
Methods included from NamedHash
#camelize_name, #classify_name, #name, #upcase_name
Constructor Details
#initialize(field_hash) ⇒ Field
Returns a new instance of Field.
85
86
87
|
# File 'lib/graphql_schema.rb', line 85
def initialize(field_hash)
@hash = field_hash
end
|
Instance Method Details
#args ⇒ Object
89
90
91
|
# File 'lib/graphql_schema.rb', line 89
def args
@args ||= @hash.fetch('args').map{ |arg_hash| InputValue.new(arg_hash) }
end
|
#optional_args ⇒ Object
97
98
99
|
# File 'lib/graphql_schema.rb', line 97
def optional_args
@optional_args ||= args.reject{ |arg| arg.type.non_null? }
end
|
#required_args ⇒ Object
93
94
95
|
# File 'lib/graphql_schema.rb', line 93
def required_args
@required_args ||= args.select{ |arg| arg.type.non_null? }
end
|
#subfields? ⇒ Boolean
105
106
107
|
# File 'lib/graphql_schema.rb', line 105
def subfields?
type.subfields?
end
|
#type ⇒ Object
101
102
103
|
# File 'lib/graphql_schema.rb', line 101
def type
@type ||= TypeDeclaration.new(@hash.fetch('type'))
end
|