Method: Regexp::MatchLength#initialize
- Defined in:
- lib/regexp_parser/expression/methods/match_length.rb
#initialize(exp, opts = {}) ⇒ MatchLength
Returns a new instance of MatchLength.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/regexp_parser/expression/methods/match_length.rb', line 9 def initialize(exp, opts = {}) self.exp_class = exp.class self.min_rep = exp.repetitions.min self.max_rep = exp.repetitions.max if (base = opts[:base]) self.base_min = base self.base_max = base self.reify = ->{ '.' * base } else self.base_min = opts.fetch(:base_min) self.base_max = opts.fetch(:base_max) self.reify = opts.fetch(:reify) end end |