Class: Leftovers::Matchers::NodeHasAnyKeywordArgument
- Inherits:
-
Object
- Object
- Leftovers::Matchers::NodeHasAnyKeywordArgument
- Includes:
- ComparableInstance
- Defined in:
- lib/leftovers/matchers/node_has_any_keyword_argument.rb
Instance Attribute Summary collapse
-
#matcher ⇒ Object
readonly
Returns the value of attribute matcher.
Instance Method Summary collapse
- #===(node) ⇒ Object
-
#initialize(matcher) ⇒ NodeHasAnyKeywordArgument
constructor
A new instance of NodeHasAnyKeywordArgument.
Methods included from ComparableInstance
Constructor Details
#initialize(matcher) ⇒ NodeHasAnyKeywordArgument
Returns a new instance of NodeHasAnyKeywordArgument.
10 11 12 13 14 |
# File 'lib/leftovers/matchers/node_has_any_keyword_argument.rb', line 10 def initialize(matcher) @matcher = matcher freeze end |
Instance Attribute Details
#matcher ⇒ Object (readonly)
Returns the value of attribute matcher.
8 9 10 |
# File 'lib/leftovers/matchers/node_has_any_keyword_argument.rb', line 8 def matcher @matcher end |
Instance Method Details
#===(node) ⇒ Object
16 17 18 19 20 |
# File 'lib/leftovers/matchers/node_has_any_keyword_argument.rb', line 16 def ===(node) kwargs = node.kwargs kwargs.children.any?(@matcher) if kwargs # rubocop:disable Style/SafeNavigation because there are multiple steps and this should be a configuration option end |