Class: Yardstick::Measurement
- Inherits:
-
Object
- Object
- Yardstick::Measurement
- Defined in:
- lib/yardstick/measurement.rb
Overview
A measurement given a constraint on the docs
Instance Method Summary collapse
-
#description ⇒ String
Return the Measurement description.
-
#initialize(rule) ⇒ Yardstick::Measurement
constructor
Return a Measurement instance.
-
#ok? ⇒ Boolean
Return true if the measurement was successful.
-
#puts(io = $stdout) ⇒ undefined
Warns the results the measurement if it was not successful.
-
#skip? ⇒ Boolean
Return true if the measurement was skipped.
Constructor Details
#initialize(rule) ⇒ Yardstick::Measurement
Return a Measurement instance
18 19 20 21 22 |
# File 'lib/yardstick/measurement.rb', line 18 def initialize(rule) @document = rule.document @rule = rule @result = measure end |
Instance Method Details
#description ⇒ String
Return the Measurement description
82 83 84 |
# File 'lib/yardstick/measurement.rb', line 82 def description @rule.class.description end |
#ok? ⇒ Boolean
Return true if the measurement was successful
36 37 38 |
# File 'lib/yardstick/measurement.rb', line 36 def ok? @result == true || skip? end |
#puts(io = $stdout) ⇒ undefined
Warns the results the measurement if it was not successful
67 68 69 70 71 |
# File 'lib/yardstick/measurement.rb', line 67 def puts(io = $stdout) unless ok? io.puts("#{@document.file}:#{@document.line}: #{@document.path}: #{description}") end end |
#skip? ⇒ Boolean
Return true if the measurement was skipped
52 53 54 |
# File 'lib/yardstick/measurement.rb', line 52 def skip? @result == :skip end |