Class: ActiveDoc::Descriptions::MethodArgumentDescription::RegexpArgumentExpectation
- Inherits:
-
ArgumentExpectation
- Object
- ArgumentExpectation
- ActiveDoc::Descriptions::MethodArgumentDescription::RegexpArgumentExpectation
- 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) ⇒ RegexpArgumentExpectation
constructor
A new instance of RegexpArgumentExpectation.
- #to_rdoc ⇒ Object
Methods inherited from ArgumentExpectation
#additional_rdoc, find, #fulfilled?, inherited
Constructor Details
#initialize(argument) ⇒ RegexpArgumentExpectation
Returns a new instance of RegexpArgumentExpectation.
156 157 158 |
# File 'lib/active_doc/descriptions/method_argument_description.rb', line 156 def initialize(argument) @regexp = argument end |
Class Method Details
.from(argument, options, proc) ⇒ Object
174 175 176 177 178 |
# File 'lib/active_doc/descriptions/method_argument_description.rb', line 174 def self.from(argument, , proc) if argument.is_a? Regexp self.new(argument) end end |
Instance Method Details
#condition?(value, args_with_vals) ⇒ Boolean
160 161 162 |
# File 'lib/active_doc/descriptions/method_argument_description.rb', line 160 def condition?(value, args_with_vals) value =~ @regexp end |
#expectation_fail_to_s ⇒ Object
Expected to… NOTE: Possible thread-safe problem
166 167 168 |
# File 'lib/active_doc/descriptions/method_argument_description.rb', line 166 def expectation_fail_to_s "match #{@regexp}, got '#{@failed_value.inspect}'" end |
#to_rdoc ⇒ Object
170 171 172 |
# File 'lib/active_doc/descriptions/method_argument_description.rb', line 170 def to_rdoc @regexp.inspect.gsub('\\') { '\\\\' } end |