Class: GraphQL::Client::Query::InlineFragment
- Inherits:
-
Object
- Object
- GraphQL::Client::Query::InlineFragment
- Includes:
- HasSelectionSet
- Defined in:
- lib/graphql_client/query/inline_fragment.rb
Constant Summary
Constants included from HasSelectionSet
HasSelectionSet::ID_FIELD_NAME, HasSelectionSet::INVALID_FIELD, HasSelectionSet::UNDEFINED_FRAGMENT
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Attributes included from HasSelectionSet
Instance Method Summary collapse
-
#initialize(type, document:) {|_self| ... } ⇒ InlineFragment
constructor
A new instance of InlineFragment.
- #resolver_type ⇒ Object
- #to_query(indent: '') ⇒ Object (also: #to_s)
Methods included from HasSelectionSet
#add_connection, #add_field, #add_fields, #add_fragment
Constructor Details
#initialize(type, document:) {|_self| ... } ⇒ InlineFragment
Returns a new instance of InlineFragment.
11 12 13 14 15 16 17 |
# File 'lib/graphql_client/query/inline_fragment.rb', line 11 def initialize(type, document:) @type = type @document = document @selection_set = SelectionSet.new yield self if block_given? end |
Instance Attribute Details
#document ⇒ Object (readonly)
Returns the value of attribute document.
9 10 11 |
# File 'lib/graphql_client/query/inline_fragment.rb', line 9 def document @document end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
9 10 11 |
# File 'lib/graphql_client/query/inline_fragment.rb', line 9 def type @type end |
Instance Method Details
#resolver_type ⇒ Object
19 20 21 |
# File 'lib/graphql_client/query/inline_fragment.rb', line 19 def resolver_type type end |
#to_query(indent: '') ⇒ Object Also known as: to_s
23 24 25 26 27 28 29 |
# File 'lib/graphql_client/query/inline_fragment.rb', line 23 def to_query(indent: '') indent.dup.tap do |query_string| query_string << "... on #{type.name} {\n" query_string << selection_set.to_query(indent) query_string << "\n#{indent}}" end end |