Class: Yardstick::Rule
- Inherits:
-
Object
- Object
- Yardstick::Rule
- Defined in:
- lib/yardstick/rule.rb
Overview
A constraint on the docs
Instance Method Summary collapse
-
#eql?(other) ⇒ Boolean
Test if Rule is equal to another rule.
-
#hash ⇒ Integer
private
Return hash identifier for the Rule.
-
#initialize(description) { ... } ⇒ Rule
constructor
private
Return a Rule instance.
-
#measure(docstring) ⇒ Measurement
private
Return a Measurement for a docstring.
Constructor Details
#initialize(description) { ... } ⇒ Rule
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return a Rule instance
20 21 22 23 |
# File 'lib/yardstick/rule.rb', line 20 def initialize(description, &block) @description = description.to_str @block = block end |
Instance Method Details
#eql?(other) ⇒ Boolean
Test if Rule is equal to another rule
50 51 52 |
# File 'lib/yardstick/rule.rb', line 50 def eql?(other) @description.eql?(other.instance_variable_get(:@description)) end |
#hash ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return hash identifier for the Rule
60 61 62 |
# File 'lib/yardstick/rule.rb', line 60 def hash @description.hash end |
#measure(docstring) ⇒ Measurement
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return a Measurement for a docstring
34 35 36 |
# File 'lib/yardstick/rule.rb', line 34 def measure(docstring) Measurement.new(@description, docstring, &@block) end |