Class: Regexp::Expression::Group::Named

Inherits:
Capture show all
Defined in:
lib/regexp_parser/expression/classes/group.rb

Instance Attribute Summary collapse

Attributes inherited from Subexpression

#expressions

Attributes inherited from Base

#level, #options, #quantifier, #text, #token, #ts, #type

Instance Method Summary collapse

Methods inherited from Base

#capturing?, #comment?, #to_s

Methods inherited from Subexpression

#<<, #[], #each, #each_with_index, #first, #insert, #last, #length, #to_s

Methods inherited from Base

#case_insensitive?, #coded_offset, #free_spacing?, #full_length, #greedy?, #multiline?, #offset, #possessive?, #quantified?, #quantify, #quantity, #reluctant?, #starts_at, #terminal?, #to_re, #to_s

Constructor Details

#initialize(token) ⇒ Named

Returns a new instance of Named.



38
39
40
41
# File 'lib/regexp_parser/expression/classes/group.rb', line 38

def initialize(token)
  @name = token.text[3..-2]
  super(token)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



36
37
38
# File 'lib/regexp_parser/expression/classes/group.rb', line 36

def name
  @name
end

Instance Method Details

#cloneObject



43
44
45
46
47
# File 'lib/regexp_parser/expression/classes/group.rb', line 43

def clone
  copy = super
  copy.instance_variable_set(:@name, @name.dup)
  copy
end