Class: RuboCop::GraphQL::Argument
- Inherits:
-
Object
- Object
- RuboCop::GraphQL::Argument
- Extended by:
- NodePattern::Macros
- Defined in:
- lib/rubocop/graphql/argument.rb,
lib/rubocop/graphql/argument/block.rb,
lib/rubocop/graphql/argument/kwargs.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Instance Method Summary collapse
- #argument_as(node) ⇒ Object
- #argument_description(node) ⇒ Object
- #argument_name(node) ⇒ Object
- #as ⇒ Object
- #block ⇒ Object
- #description ⇒ Object
-
#initialize(node) ⇒ Argument
constructor
A new instance of Argument.
- #kwargs ⇒ Object
- #name ⇒ Object
Constructor Details
#initialize(node) ⇒ Argument
Returns a new instance of Argument.
25 26 27 |
# File 'lib/rubocop/graphql/argument.rb', line 25 def initialize(node) @node = node end |
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
23 24 25 |
# File 'lib/rubocop/graphql/argument.rb', line 23 def node @node end |
Instance Method Details
#argument_as(node) ⇒ Object
19 20 21 |
# File 'lib/rubocop/graphql/argument.rb', line 19 def_node_matcher :argument_as, <<~PATTERN (pair (sym :as) (sym $_)) PATTERN |
#argument_description(node) ⇒ Object
9 10 11 |
# File 'lib/rubocop/graphql/argument.rb', line 9 def_node_matcher :argument_description, <<~PATTERN (send nil? :argument _ _ (:str $_) ...) PATTERN |
#argument_name(node) ⇒ Object
14 15 16 |
# File 'lib/rubocop/graphql/argument.rb', line 14 def_node_matcher :argument_name, <<~PATTERN (send nil? :argument (:sym $_) ...) PATTERN |
#as ⇒ Object
33 34 35 |
# File 'lib/rubocop/graphql/argument.rb', line 33 def as @as ||= argument_as(kwargs.as) end |
#block ⇒ Object
45 46 47 |
# File 'lib/rubocop/graphql/argument.rb', line 45 def block @block ||= Argument::Block.new(@node.parent) end |
#description ⇒ Object
37 38 39 |
# File 'lib/rubocop/graphql/argument.rb', line 37 def description @description ||= argument_description(@node) || kwargs.description || block.description end |
#kwargs ⇒ Object
41 42 43 |
# File 'lib/rubocop/graphql/argument.rb', line 41 def kwargs @kwargs ||= Argument::Kwargs.new(@node) end |
#name ⇒ Object
29 30 31 |
# File 'lib/rubocop/graphql/argument.rb', line 29 def name @name ||= argument_name(@node) end |