Class: RegexpExamples::MultiGroup
- Inherits:
-
Object
- Object
- RegexpExamples::MultiGroup
- Defined in:
- lib/regexp-examples/groups.rb
Overview
A collection of other groups. Basically any regex that contains brackets will be parsed using one of these. The simplest example is: /(a)/ - Which is a MultiGroup, containing one SingleCharGroup
Instance Attribute Summary collapse
-
#group_id ⇒ Object
readonly
Returns the value of attribute group_id.
Instance Method Summary collapse
-
#initialize(groups, group_id) ⇒ MultiGroup
constructor
A new instance of MultiGroup.
- #random_result ⇒ Object
- #result ⇒ Object
Constructor Details
#initialize(groups, group_id) ⇒ MultiGroup
Returns a new instance of MultiGroup.
130 131 132 133 |
# File 'lib/regexp-examples/groups.rb', line 130 def initialize(groups, group_id) @groups = groups @group_id = group_id end |
Instance Attribute Details
#group_id ⇒ Object (readonly)
Returns the value of attribute group_id.
129 130 131 |
# File 'lib/regexp-examples/groups.rb', line 129 def group_id @group_id end |
Instance Method Details
#random_result ⇒ Object
139 140 141 |
# File 'lib/regexp-examples/groups.rb', line 139 def random_result result_by_method(:random_result) end |
#result ⇒ Object
135 136 137 |
# File 'lib/regexp-examples/groups.rb', line 135 def result result_by_method(:result) end |