Sha256: d5ea7eefef1449e0d87239355b176d57d2454030ca4d1af8fe9f8e9353b3d8ea
Contents?: true
Size: 1.51 KB
Versions: 1
Compression:
Stored size: 1.51 KB
Contents
# frozen_string_literal: true require 'graphql' require 'graphql_rails/attributes/attributable' require 'graphql_rails/attributes/attribute_configurable' require 'graphql_rails/input_configurable' module GraphqlRails module Attributes # contains info about single graphql attribute class Attribute include Attributable include AttributeConfigurable include InputConfigurable attr_reader :attributes def initialize(name) @initial_name = name @property = name.to_s @attributes ||= {} end def property(new_value = NOT_SET) return @property if new_value == NOT_SET @property = new_value.to_s self end def field_args [ field_name, type_parser.type_arg, description ].compact end def field_options { method: property.to_sym, null: optional?, camelize: camelize?, groups: groups, hidden_in_groups: hidden_in_groups, **deprecation_reason_params, **extras_options } end protected attr_reader :initial_name private def extras_options return {} if extras.empty? { extras: extras } end def camelize? options[:input_format] != :original && options[:attribute_name_format] != :original end def deprecation_reason_params { deprecation_reason: deprecation_reason }.compact end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
graphql_rails-2.4.0 | lib/graphql_rails/attributes/attribute.rb |