Object
# File lib/rack/mount/vendor/regin/regin/group.rb, line 5 5: def initialize(expression, options = {}) 6: @quantifier = @index = @name = nil 7: @capture = true 8: @expression = expression.dup(options) 9: 10: @quantifier = options[:quantifier] if options.key?(:quantifier) 11: @capture = options[:capture] if options.key?(:capture) 12: @index = options[:index] if options.key?(:index) 13: @name = options[:name] if options.key?(:name) 14: end
# File lib/rack/mount/vendor/regin/regin/group.rb, line 63 63: def capture? 64: capture 65: end
# File lib/rack/mount/vendor/regin/regin/group.rb, line 43 43: def dup(options = {}) 44: original_options = option_names.inject({}) do |h, m| 45: h[m.to_sym] = send(m) 46: h 47: end 48: self.class.new(expression, original_options.merge(options)) 49: end
# File lib/rack/mount/vendor/regin/regin/group.rb, line 59 59: def include?(char) 60: expression.include?(char) 61: end
Returns true if expression could be treated as a literal string.
A Group is literal if its expression is literal and it has no quantifier.
# File lib/rack/mount/vendor/regin/regin/group.rb, line 23 23: def literal? 24: quantifier.nil? && expression.literal? 25: end
# File lib/rack/mount/vendor/regin/regin/group.rb, line 55 55: def match(char) 56: to_regexp.match(char) 57: end
# File lib/rack/mount/vendor/regin/regin/group.rb, line 16 16: def option_names 17: %( quantifier capture index name ) 18: end
# File lib/rack/mount/vendor/regin/regin/group.rb, line 37 37: def to_regexp(anchored = false) 38: re = to_s 39: re = "\\A#{re}\\Z" if anchored 40: Regexp.compile(re) 41: end
# File lib/rack/mount/vendor/regin/regin/group.rb, line 27 27: def to_s(parent = false) 28: if !expression.options? 29: "(#{capture ? '' : '?:'}#{expression.to_s(parent)})#{quantifier}" 30: elsif capture == false 31: "#{expression.to_s}#{quantifier}" 32: else 33: "(#{expression.to_s})#{quantifier}" 34: end 35: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.