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

Inherits:
Struct
  • Object
show all
Defined in:
lib/rubocop/cop/mixin/hash_shorthand_syntax.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nodeObject

Returns the value of attribute node

Returns:

  • (Object)

    the current value of node



14
15
16
# File 'lib/rubocop/cop/mixin/hash_shorthand_syntax.rb', line 14

def node
  @node
end

Instance Method Details

#first_argumentObject



23
24
25
# File 'lib/rubocop/cop/mixin/hash_shorthand_syntax.rb', line 23

def first_argument
  node.first_argument
end

#last_argumentObject



27
28
29
# File 'lib/rubocop/cop/mixin/hash_shorthand_syntax.rb', line 27

def last_argument
  node.last_argument
end

#selectorObject



15
16
17
18
19
20
21
# File 'lib/rubocop/cop/mixin/hash_shorthand_syntax.rb', line 15

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