Class: Homebrew::Style::Offenses Private

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
brew/Library/Homebrew/style.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Collection of style offenses.

Instance Method Summary collapse

Constructor Details

#initialize(paths) ⇒ Offenses

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Offenses.



229
230
231
232
233
234
235
236
237
# File 'brew/Library/Homebrew/style.rb', line 229

def initialize(paths)
  @offenses = {}
  paths.each do |f|
    next if f["offenses"].empty?

    path = Pathname(f["path"]).realpath
    @offenses[path] = f["offenses"].map { |x| Offense.new(x) }
  end
end

Instance Method Details

#each(*args, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



243
244
245
# File 'brew/Library/Homebrew/style.rb', line 243

def each(*args, &block)
  @offenses.each(*args, &block)
end

#for_path(path) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



239
240
241
# File 'brew/Library/Homebrew/style.rb', line 239

def for_path(path)
  @offenses.fetch(Pathname(path), [])
end