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
19 20 21 22 23 |
# File 'lib/yardstick/measurement.rb', line 19 def initialize(rule) @document = rule.document @rule = rule @result = measure end |
Instance Method Details
#description ⇒ String
Return the Measurement description
83 84 85 |
# File 'lib/yardstick/measurement.rb', line 83 def description @rule.class.description end |
#ok? ⇒ Boolean
Return true if the measurement was successful
37 38 39 |
# File 'lib/yardstick/measurement.rb', line 37 def ok? @result == true || skip? end |
#puts(io = $stdout) ⇒ undefined
Warns the results the measurement if it was not successful
68 69 70 71 72 |
# File 'lib/yardstick/measurement.rb', line 68 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
53 54 55 |
# File 'lib/yardstick/measurement.rb', line 53 def skip? @result == :skip end |