Class: Patm::Pattern::Group
- Inherits:
-
Patm::Pattern
- Object
- Patm::Pattern
- Patm::Pattern::Group
- Defined in:
- lib/patm.rb
Instance Attribute Summary collapse
-
#index ⇒ Object
readonly
Returns the value of attribute index.
Instance Method Summary collapse
- #compile_internal(free_index, target_name = "_obj") ⇒ Object
- #execute(mmatch, obj) ⇒ Object
-
#initialize(index) ⇒ Group
constructor
A new instance of Group.
- #inspect ⇒ Object
Methods inherited from Patm::Pattern
#&, build_from, #compile, #rest?
Constructor Details
#initialize(index) ⇒ Group
Returns a new instance of Group.
195 196 197 |
# File 'lib/patm.rb', line 195 def initialize(index) @index = index end |
Instance Attribute Details
#index ⇒ Object (readonly)
Returns the value of attribute index.
198 199 200 |
# File 'lib/patm.rb', line 198 def index @index end |
Instance Method Details
#compile_internal(free_index, target_name = "_obj") ⇒ Object
204 205 206 207 208 209 210 |
# File 'lib/patm.rb', line 204 def compile_internal(free_index, target_name = "_obj") [ "_match[#{@index}] = #{target_name}; true", [], free_index ] end |
#execute(mmatch, obj) ⇒ Object
199 200 201 202 |
# File 'lib/patm.rb', line 199 def execute(mmatch, obj) mmatch[@index] = obj true end |
#inspect ⇒ Object
203 |
# File 'lib/patm.rb', line 203 def inspect; "GROUP(#{@index})"; end |