Class: Hackle::ValueMatcherFactory
- Inherits:
-
Object
- Object
- Hackle::ValueMatcherFactory
- Defined in:
- lib/hackle/internal/evaluation/match/value/value_matcher_factory.rb
Instance Method Summary collapse
- #get(value_type) ⇒ ValueMatcher
-
#initialize ⇒ ValueMatcherFactory
constructor
A new instance of ValueMatcherFactory.
Constructor Details
#initialize ⇒ ValueMatcherFactory
Returns a new instance of ValueMatcherFactory.
9 10 11 12 13 14 15 16 17 |
# File 'lib/hackle/internal/evaluation/match/value/value_matcher_factory.rb', line 9 def initialize @matchers = { ValueType::STRING => StringMatcher.new, ValueType::NUMBER => NumberMatcher.new, ValueType::BOOLEAN => BooleanMatcher.new, ValueType::VERSION => VersionMatcher.new, ValueType::JSON => StringMatcher.new }.freeze end |
Instance Method Details
#get(value_type) ⇒ ValueMatcher
21 22 23 24 25 26 |
# File 'lib/hackle/internal/evaluation/match/value/value_matcher_factory.rb', line 21 def get(value_type) matcher = @matchers[value_type] raise ArgumentError, "Unsupported ValueType [#{value_type}]" unless matcher matcher end |