Sha256: 44399989b9cec47e622d5911ae39c72c9b37f6e3eb57821446eb9ad63078578e

Contents?: true

Size: 677 Bytes

Versions: 4

Compression:

Stored size: 677 Bytes

Contents

module Graphlient
  class Query
    private

    def append_node(node, args, arg_processor: nil, &block)
      if node.to_s.start_with?("___")
        node = node.to_s.gsub("___", "...").gsub("__", "::").to_sym
      end

      # add field
      @query_str << "\n#{indent}#{node}"
      # add filter
      hash_arguments = hash_arg(args)
      @query_str << "(#{args_str(hash_arguments, arg_processor: arg_processor)})" if hash_arguments

      if block_given?
        @indents += 1
        @query_str << '{'
        instance_eval(&block)
        @query_str << '}'
        @indents -= 1
      end

      @query_str << "\n#{indent}"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ecoportal-api-graphql-0.1.8 lib/ecoportal/api/common/graphql/patches/query.rb
ecoportal-api-graphql-0.1.7 lib/ecoportal/api/common/graphql/patches/query.rb
ecoportal-api-graphql-0.1.6 lib/ecoportal/api/common/graphql/patches/query.rb
ecoportal-api-graphql-0.1.5 lib/ecoportal/api/common/graphql/patches/query.rb