Class: ActiveDoc::Descriptions::MethodArgumentDescription::ComplexConditionArgumentExpectation
- Inherits:
-
ArgumentExpectation
- Object
- ArgumentExpectation
- ActiveDoc::Descriptions::MethodArgumentDescription::ComplexConditionArgumentExpectation
- Defined in:
- lib/active_doc/descriptions/method_argument_description.rb
Class Method Summary collapse
Instance Method Summary collapse
- #condition?(value, args_with_vals) ⇒ Boolean
-
#expectation_fail_to_s ⇒ Object
Expected to…
-
#initialize(argument) ⇒ ComplexConditionArgumentExpectation
constructor
A new instance of ComplexConditionArgumentExpectation.
- #to_rdoc ⇒ Object
Methods inherited from ArgumentExpectation
#additional_rdoc, find, #fulfilled?, inherited
Constructor Details
#initialize(argument) ⇒ ComplexConditionArgumentExpectation
Returns a new instance of ComplexConditionArgumentExpectation.
208 209 210 |
# File 'lib/active_doc/descriptions/method_argument_description.rb', line 208 def initialize(argument) @proc = argument end |
Class Method Details
.from(argument, options, proc) ⇒ Object
226 227 228 229 230 |
# File 'lib/active_doc/descriptions/method_argument_description.rb', line 226 def self.from(argument, , proc) if proc.is_a?(Proc) && proc.arity == 1 self.new(proc) end end |
Instance Method Details
#condition?(value, args_with_vals) ⇒ Boolean
212 213 214 215 |
# File 'lib/active_doc/descriptions/method_argument_description.rb', line 212 def condition?(value, args_with_vals) other_values = args_with_vals.inject({}) { |h, (k, v)| h[k] = v[:val];h } @proc.call(other_values) end |
#expectation_fail_to_s ⇒ Object
Expected to…
218 219 220 |
# File 'lib/active_doc/descriptions/method_argument_description.rb', line 218 def expectation_fail_to_s "satisfy given condition, got #{@failed_value.inspect}" end |
#to_rdoc ⇒ Object
222 223 224 |
# File 'lib/active_doc/descriptions/method_argument_description.rb', line 222 def to_rdoc "Complex Condition" end |