Sha256: c7be74c06720cc65d08538a1a4c2c2ec38be496940402fcb76b6c2a5cec18f8a

Contents?: true

Size: 764 Bytes

Versions: 4

Compression:

Stored size: 764 Bytes

Contents

# frozen_string_literal: true

require_relative './query'
require_relative './fragment'

module GQLi
  # GraphQL-like DSL methods
  module DSL
    # Creates a Query object
    #
    # Can be used at a class level
    def self.query(name = nil, &block)
      Query.new(name, &block)
    end

    # Creates a Fragment object
    #
    # Can be used at a class level
    def self.fragment(name, on, &block)
      Fragment.new(name, on, &block)
    end

    # Creates a Query object
    #
    # Can be used at an instance level
    def query(name = nil, &block)
      Query.new(name, &block)
    end

    # Creates a Fragment object
    #
    # Can be used at an instance level
    def fragment(name, on, &block)
      Fragment.new(name, on, &block)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gqli-0.4.0 lib/gqli/dsl.rb
gqli-0.3.0 lib/gqli/dsl.rb
gqli-0.2.0 lib/gqli/dsl.rb
gqli-0.1.0 lib/gqli/dsl.rb