Class: RegexpExamples::MultiGroup

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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_idObject (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_resultObject



139
140
141
# File 'lib/regexp-examples/groups.rb', line 139

def random_result
  result_by_method(:random_result)
end

#resultObject



135
136
137
# File 'lib/regexp-examples/groups.rb', line 135

def result
  result_by_method(:result)
end