Class: HttpStub::Models::RegexpableValue
- Inherits:
-
Object
- Object
- HttpStub::Models::RegexpableValue
- Defined in:
- lib/http_stub/models/regexpable_value.rb
Instance Method Summary collapse
-
#initialize(value) ⇒ RegexpableValue
constructor
A new instance of RegexpableValue.
- #match?(other_value) ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(value) ⇒ RegexpableValue
Returns a new instance of RegexpableValue.
6 7 8 |
# File 'lib/http_stub/models/regexpable_value.rb', line 6 def initialize(value) @value = value end |
Instance Method Details
#match?(other_value) ⇒ Boolean
10 11 12 13 |
# File 'lib/http_stub/models/regexpable_value.rb', line 10 def match?(other_value) match_data = @value.match(/^regexp:(.*)/) match_data ? !!Regexp.new(match_data[1]).match(other_value) : other_value == @value end |
#to_s ⇒ Object
15 16 17 |
# File 'lib/http_stub/models/regexpable_value.rb', line 15 def to_s @value end |