123456789_123456789_123456789_123456789_123456789_

Class: RuboCop::Cop::HashShorthandSyntax::DefNode

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Struct
Instance Chain:
self, Struct
Inherits: Struct
  • Object
Defined in: lib/rubocop/cop/mixin/hash_shorthand_syntax.rb

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#node (rw, private)

[ GitHub ]

  
# File 'lib/rubocop/cop/mixin/hash_shorthand_syntax.rb', line 216

DefNode = Struct.new(:node)

Instance Method Details

#first_argument

[ GitHub ]

  
# File 'lib/rubocop/cop/mixin/hash_shorthand_syntax.rb', line 225

def first_argument
  node.first_argument
end

#last_argument

[ GitHub ]

  
# File 'lib/rubocop/cop/mixin/hash_shorthand_syntax.rb', line 229

def last_argument
  node.last_argument
end

#selector

[ GitHub ]

  
# File 'lib/rubocop/cop/mixin/hash_shorthand_syntax.rb', line 217

def selector
  if node.loc.respond_to?(:selector)
    node.loc.selector
  else
    node.loc.keyword
  end
end