class GQLi::Fragment

Fragment wrapper

Attributes

__on_type[R]

Public Class Methods

new(name, on, &block) click to toggle source
Calls superclass method GQLi::Base::new
# File lib/gqli/fragment.rb, line 11
def initialize(name, on, &block)
  super(name, 0, &block)
  @__on_type = on
end

Public Instance Methods

to_gql() click to toggle source

Serializes to a GraphQL string

# File lib/gqli/fragment.rb, line 17
    def to_gql
      <<~GQL
        fragment #{__name} on #{__on_type} {
        #{__nodes.map(&:to_gql).join("\n")}
        }
      GQL
    end