Class: Pelusa::Lint::EvalUsage

Inherits:
Object
  • Object
show all
Defined in:
lib/pelusa/lint/eval_usage.rb

Instance Method Summary collapse

Constructor Details

#initializeEvalUsage

Returns a new instance of EvalUsage.



6
7
8
# File 'lib/pelusa/lint/eval_usage.rb', line 6

def initialize
  @violations = Set.new
end

Instance Method Details

#check(klass) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/pelusa/lint/eval_usage.rb', line 10

def check(klass)
  iterate_lines!(klass)

  if @violations.empty?
    SuccessfulAnalysis.new(name)
  else
    FailedAnalysis.new(name, @violations) do |violations|
      "There are #{violations.length} eval statement in lines #{violations.to_a.join(', ')}"
    end
  end
end