Class: Homebrew::Style::Offenses Private

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
style.rb

Overview

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

Collection of style offenses.

Instance Method Summary collapse

Methods included from Enumerable

#compact_blank, #exclude?

Constructor Details

#initialize(paths) ⇒ Offenses

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns a new instance of Offenses.



288
289
290
291
292
293
294
295
296
# File 'style.rb', line 288

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. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



302
303
304
# File 'style.rb', line 302

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

#for_path(path) ⇒ Object

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



298
299
300
# File 'style.rb', line 298

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