Class: DuckTesting::Type::Constant
- Defined in:
- lib/duck_testing/type/constant.rb
Constant Summary collapse
- CONSTANTS =
%w(true false)
Instance Attribute Summary collapse
-
#constant ⇒ Object
readonly
Returns the value of attribute constant.
Instance Method Summary collapse
-
#initialize(constant) ⇒ Constant
constructor
A new instance of Constant.
- #match?(object) ⇒ Boolean
- #to_s ⇒ String
Constructor Details
#initialize(constant) ⇒ Constant
Returns a new instance of Constant.
10 11 12 |
# File 'lib/duck_testing/type/constant.rb', line 10 def initialize(constant) @constant = constant end |
Instance Attribute Details
#constant ⇒ Object (readonly)
Returns the value of attribute constant.
8 9 10 |
# File 'lib/duck_testing/type/constant.rb', line 8 def constant @constant end |
Instance Method Details
#match?(object) ⇒ Boolean
16 17 18 |
# File 'lib/duck_testing/type/constant.rb', line 16 def match?(object) object == constant end |
#to_s ⇒ String
21 22 23 |
# File 'lib/duck_testing/type/constant.rb', line 21 def to_s constant.to_s end |