Module: JRuby::Lint::Checker

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#collectorObject

Returns the value of attribute collector.



31
32
33
# File 'lib/jruby/lint/checkers.rb', line 31

def collector
  @collector
end

Class Method Details

.included(cls) ⇒ Object



5
6
7
# File 'lib/jruby/lint/checkers.rb', line 5

def self.included(cls)
  loaded_checkers << cls
end

.loaded_checkersObject



9
10
11
# File 'lib/jruby/lint/checkers.rb', line 9

def self.loaded_checkers
  @checkers ||= []
end

Instance Method Details

#grand_parentObject



21
22
23
# File 'lib/jruby/lint/checkers.rb', line 21

def grand_parent
  collector.stack.size >= 3 ? collector.stack[-3] : nil 
end

#parentObject

What is parent during visit of the current node being visited.



17
18
19
# File 'lib/jruby/lint/checkers.rb', line 17

def parent
  collector.stack.size >= 2 ? collector.stack[-2] : nil 
end

#src_line(line) ⇒ Object

source line with line node provides



27
28
29
# File 'lib/jruby/lint/checkers.rb', line 27

def src_line(line)
  collector.contents.split(/\n/)[line]
end