Class: GraphQL::Client::Definition
- Inherits:
-
Object
- Object
- GraphQL::Client::Definition
- Defined in:
- lib/graphql/client.rb
Instance Attribute Summary collapse
-
#_nodes ⇒ Object
readonly
Returns the value of attribute _nodes.
Instance Method Summary collapse
- #document ⇒ Object
-
#initialize(name:, client:, source:) ⇒ Definition
constructor
A new instance of Definition.
- #new(*args) ⇒ Object
- #operation_name ⇒ Object
Constructor Details
#initialize(name:, client:, source:) ⇒ Definition
Returns a new instance of Definition.
23 24 25 26 27 28 |
# File 'lib/graphql/client.rb', line 23 def initialize(name:, client:, source:) @name = name @client = client @_nodes = @client._parse(@name, source) @query_result = GraphQL::Client::QueryResult.wrap(@_nodes.first, name: name) end |
Instance Attribute Details
#_nodes ⇒ Object (readonly)
Returns the value of attribute _nodes.
30 31 32 |
# File 'lib/graphql/client.rb', line 30 def _nodes @_nodes end |
Instance Method Details
#document ⇒ Object
40 41 42 |
# File 'lib/graphql/client.rb', line 40 def document @document ||= Language::OperationSlice.slice(@client.document, operation_name).deep_freeze end |
#new(*args) ⇒ Object
44 45 46 |
# File 'lib/graphql/client.rb', line 44 def new(*args) @query_result.new(*args) end |