Class: RgGen::Core::InputBase::InputMatcher
- Defined in:
- lib/rggen/core/input_base/input_matcher.rb
Instance Method Summary collapse
-
#initialize(pattern_or_patterns, **options, &converter) ⇒ InputMatcher
constructor
A new instance of InputMatcher.
- #match(rhs) ⇒ Object
- #match_automatically? ⇒ Boolean
Constructor Details
#initialize(pattern_or_patterns, **options, &converter) ⇒ InputMatcher
Returns a new instance of InputMatcher.
7 8 9 10 11 |
# File 'lib/rggen/core/input_base/input_matcher.rb', line 7 def initialize(pattern_or_patterns, **, &converter) @options = @converter = converter @patterns = format_patterns(pattern_or_patterns) end |
Instance Method Details
#match(rhs) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/rggen/core/input_base/input_matcher.rb', line 13 def match(rhs) rhs .to_s .then { |s| ignore_blanks? && delete_blanks(s) || s } .then(&method(:match_patterns)) end |
#match_automatically? ⇒ Boolean
20 21 22 |
# File 'lib/rggen/core/input_base/input_matcher.rb', line 20 def match_automatically? @options.fetch(:match_automatically, true) end |