Class: MetadataCop::Cop::Team
- Inherits:
-
Object
- Object
- MetadataCop::Cop::Team
- Defined in:
- lib/metadatacop/cop/team.rb
Instance Attribute Summary collapse
-
#cops ⇒ Object
readonly
Returns the value of attribute cops.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(cops, options = {}) ⇒ Team
constructor
A new instance of Team.
- #inspect_file(file) ⇒ Object
- #run_cops(cops, file) ⇒ Object
Constructor Details
#initialize(cops, options = {}) ⇒ Team
Returns a new instance of Team.
6 7 8 9 |
# File 'lib/metadatacop/cop/team.rb', line 6 def initialize(cops, = {}) @cops = cops = end |
Instance Attribute Details
#cops ⇒ Object (readonly)
Returns the value of attribute cops.
4 5 6 |
# File 'lib/metadatacop/cop/team.rb', line 4 def cops @cops end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/metadatacop/cop/team.rb', line 4 def end |
Instance Method Details
#inspect_file(file) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/metadatacop/cop/team.rb', line 11 def inspect_file(file) linters, others = @cops.partition(&:lint?) result = run_cops(linters, file) # if the linters failed, no reason to run the others result += run_cops(others, file) if result.empty? result end |
#run_cops(cops, file) ⇒ Object
22 23 24 25 26 |
# File 'lib/metadatacop/cop/team.rb', line 22 def run_cops(cops, file) cops.inject([]) do |offenses, cop| offenses + cop.investigate(file) end end |