Class: Reginald::Group
- Inherits:
-
Struct
- Object
- Struct
- Reginald::Group
- Defined in:
- lib/rack/mount/vendor/reginald/reginald/group.rb
Instance Attribute Summary collapse
-
#capture ⇒ Object
Returns the value of attribute capture.
-
#expression ⇒ Object
Returns the value of attribute expression.
-
#index ⇒ Object
Returns the value of attribute index.
-
#name ⇒ Object
Returns the value of attribute name.
-
#quantifier ⇒ Object
Returns the value of attribute quantifier.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #capture? ⇒ Boolean
- #eql?(other) ⇒ Boolean
- #freeze ⇒ Object
- #include?(char) ⇒ Boolean
-
#initialize(*args) ⇒ Group
constructor
A new instance of Group.
- #inspect ⇒ Object
- #literal? ⇒ Boolean
- #match(char) ⇒ Object
- #to_regexp ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(*args) ⇒ Group
Returns a new instance of Group.
5 6 7 8 |
# File 'lib/rack/mount/vendor/reginald/reginald/group.rb', line 5 def initialize(*args) @capture = true super end |
Instance Attribute Details
#capture ⇒ Object
Returns the value of attribute capture.
3 4 5 |
# File 'lib/rack/mount/vendor/reginald/reginald/group.rb', line 3 def capture @capture end |
#expression ⇒ Object
Returns the value of attribute expression
2 3 4 |
# File 'lib/rack/mount/vendor/reginald/reginald/group.rb', line 2 def expression @expression end |
#index ⇒ Object
Returns the value of attribute index.
3 4 5 |
# File 'lib/rack/mount/vendor/reginald/reginald/group.rb', line 3 def index @index end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/rack/mount/vendor/reginald/reginald/group.rb', line 3 def name @name end |
#quantifier ⇒ Object
Returns the value of attribute quantifier.
3 4 5 |
# File 'lib/rack/mount/vendor/reginald/reginald/group.rb', line 3 def quantifier @quantifier end |
Instance Method Details
#==(other) ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/rack/mount/vendor/reginald/reginald/group.rb', line 38 def ==(other) case other when String other == to_s else eql?(other) end end |
#capture? ⇒ Boolean
34 35 36 |
# File 'lib/rack/mount/vendor/reginald/reginald/group.rb', line 34 def capture? capture end |
#eql?(other) ⇒ Boolean
47 48 49 50 51 52 53 54 |
# File 'lib/rack/mount/vendor/reginald/reginald/group.rb', line 47 def eql?(other) other.is_a?(self.class) && self.expression == other.expression && self.quantifier == other.quantifier && self.capture == other.capture && self.index == other.index && self.name == other.name end |
#freeze ⇒ Object
56 57 58 59 |
# File 'lib/rack/mount/vendor/reginald/reginald/group.rb', line 56 def freeze expression.freeze super end |
#include?(char) ⇒ Boolean
30 31 32 |
# File 'lib/rack/mount/vendor/reginald/reginald/group.rb', line 30 def include?(char) expression.include?(char) end |
#inspect ⇒ Object
22 23 24 |
# File 'lib/rack/mount/vendor/reginald/reginald/group.rb', line 22 def inspect to_s.inspect end |
#literal? ⇒ Boolean
10 11 12 |
# File 'lib/rack/mount/vendor/reginald/reginald/group.rb', line 10 def literal? quantifier.nil? && expression.literal? end |
#match(char) ⇒ Object
26 27 28 |
# File 'lib/rack/mount/vendor/reginald/reginald/group.rb', line 26 def match(char) to_regexp.match(char) end |
#to_regexp ⇒ Object
18 19 20 |
# File 'lib/rack/mount/vendor/reginald/reginald/group.rb', line 18 def to_regexp Regexp.compile("\\A#{to_s}\\Z") end |
#to_s ⇒ Object
14 15 16 |
# File 'lib/rack/mount/vendor/reginald/reginald/group.rb', line 14 def to_s "(#{capture ? '' : '?:'}#{expression.to_s})#{quantifier}" end |