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