Class: Rubocop::Cop::Position

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#columnObject

Returns the value of attribute column

Returns:

  • (Object)

    the current value of column



5
6
7
# File 'lib/rubocop/cop/cop.rb', line 5

def column
  @column
end

#linenoObject

Returns the value of attribute lineno

Returns:

  • (Object)

    the current value of lineno



5
6
7
# File 'lib/rubocop/cop/cop.rb', line 5

def lineno
  @lineno
end

Class Method Details

.make_position_objects(sexp) ⇒ Object

Does a recursive search and replaces each [lineno, column] array in the sexp with a Position object.



8
9
10
11
12
13
14
# File 'lib/rubocop/cop/cop.rb', line 8

def self.make_position_objects(sexp)
  if sexp[0] =~ /^@/
    sexp[2] = Position.new(*sexp[2])
  else
    sexp.grep(Array).each { |s| make_position_objects(s) }
  end
end