Class: HttpStub::Models::RegexpableValue

Inherits:
Object
  • Object
show all
Defined in:
lib/http_stub/models/regexpable_value.rb

Instance Method Summary collapse

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

Returns:

  • (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_sObject



15
16
17
# File 'lib/http_stub/models/regexpable_value.rb', line 15

def to_s
  @value
end