Sha256: 2da3a7d7a49736dd5b91bb6fdf34403caa8613f4c8026d1e497926de557631a0

Contents?: true

Size: 703 Bytes

Versions: 2

Compression:

Stored size: 703 Bytes

Contents

# frozen_string_literal: true

module Rails # :nodoc:
  module GraphQL # :nodoc:
    # Helper class to be used while configuring a field using a block. An
    # instance of this class works as proxy for changes to the actual field.
    Field::ScopedConfig = Struct.new(:field, :receiver) do
      delegate :argument, :ref_argument, :id_argument, :use, :internal?, :disabled?,
        :enabled?, :disable!, :enable!, :authorize, to: :field

      delegate_missing_to :receiver

      def method_name(value)
        field.instance_variable_set(:@method_name, value.to_sym)
      end

      def desc(value)
        field.instance_variable_set(:@desc, value.strip_heredoc.chomp)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails-graphql-0.2.1 lib/rails/graphql/field/scoped_config.rb
rails-graphql-0.2.0 lib/rails/graphql/field/scoped_config.rb