Class: AsyncapiCable::Runtime::StreamMatcher
- Inherits:
-
Object
- Object
- AsyncapiCable::Runtime::StreamMatcher
- Defined in:
- lib/asyncapi_cable/runtime/stream_matcher.rb
Instance Method Summary collapse
-
#initialize(template) ⇒ StreamMatcher
constructor
A new instance of StreamMatcher.
- #match?(stream) ⇒ Boolean
Constructor Details
#initialize(template) ⇒ StreamMatcher
Returns a new instance of StreamMatcher.
4 5 6 7 |
# File 'lib/asyncapi_cable/runtime/stream_matcher.rb', line 4 def initialize(template) @template = template.to_s @regex = build_regex(@template) end |
Instance Method Details
#match?(stream) ⇒ Boolean
9 10 11 12 |
# File 'lib/asyncapi_cable/runtime/stream_matcher.rb', line 9 def match?(stream) return false if @regex.nil? !@regex.match(stream.to_s).nil? end |