Class: DuckTesting::Violation
- Inherits:
-
Object
- Object
- DuckTesting::Violation
- Extended by:
- Forwardable
- Defined in:
- lib/duck_testing/violation.rb
Instance Attribute Summary collapse
-
#param ⇒ Object
readonly
Returns the value of attribute param.
Instance Method Summary collapse
- #expected ⇒ String
-
#initialize(call_data: nil, param: nil, expected_types: nil, param_or_return: nil) ⇒ Violation
constructor
A new instance of Violation.
- #param? ⇒ Boolean
- #return? ⇒ Boolean
Constructor Details
#initialize(call_data: nil, param: nil, expected_types: nil, param_or_return: nil) ⇒ Violation
Returns a new instance of Violation.
15 16 17 18 19 20 |
# File 'lib/duck_testing/violation.rb', line 15 def initialize(call_data: nil, param: nil, expected_types: nil, param_or_return: nil) @call_data = call_data @param = param @expected_types = expected_types @param_or_return = param_or_return end |
Instance Attribute Details
#param ⇒ Object (readonly)
Returns the value of attribute param.
9 10 11 |
# File 'lib/duck_testing/violation.rb', line 9 def param @param end |
Instance Method Details
#expected ⇒ String
33 34 35 |
# File 'lib/duck_testing/violation.rb', line 33 def expected expected_types.map(&:to_s).join(", ") end |
#param? ⇒ Boolean
23 24 25 |
# File 'lib/duck_testing/violation.rb', line 23 def param? param_or_return == :param end |
#return? ⇒ Boolean
28 29 30 |
# File 'lib/duck_testing/violation.rb', line 28 def return? param_or_return == :return end |