Class: Pelusa::Lint::CollectionWrappers

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

Instance Method Summary collapse

Constructor Details

#initializeCollectionWrappers

Returns a new instance of CollectionWrappers


4
5
6
# File 'lib/pelusa/lint/collection_wrappers.rb', line 4

def initialize
  @violations = Set.new
end

Instance Method Details

#check(klass) ⇒ Object


8
9
10
11
12
13
14
15
16
# File 'lib/pelusa/lint/collection_wrappers.rb', line 8

def check(klass)
  iterate_lines!(klass)

  return SuccessfulAnalysis.new(name) if @violations.empty?

  FailedAnalysis.new(name, @violations) do |violations|
    "Using an instance variable apart from the array ivar in lines #{violations.to_a.join(', ')}"
  end
end