Class: MetadataCop::Runner
- Inherits:
-
Object
- Object
- MetadataCop::Runner
- Defined in:
- lib/metadatacop/runner.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Runner
constructor
A new instance of Runner.
- #offenses ⇒ Object
- #ran? ⇒ Boolean
- #run(*paths) ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(options = {}) ⇒ Runner
Returns a new instance of Runner.
5 6 7 8 |
# File 'lib/metadatacop/runner.rb', line 5 def initialize( = {}) @options = @ran = false end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/metadatacop/runner.rb', line 3 def @options end |
Instance Method Details
#offenses ⇒ Object
10 11 12 |
# File 'lib/metadatacop/runner.rb', line 10 def offenses @offenses ||= {} end |
#ran? ⇒ Boolean
31 32 33 |
# File 'lib/metadatacop/runner.rb', line 31 def ran? @ran end |
#run(*paths) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/metadatacop/runner.rb', line 14 def run(*paths) paths.flatten.each_with_object(offenses) do |file, h| file_offenses = process_file(file).flatten h[file] ||= [] h[file] += file_offenses end @ran = true offenses end |
#success? ⇒ Boolean
27 28 29 |
# File 'lib/metadatacop/runner.rb', line 27 def success? offenses.empty? && ran? end |