Class: RegExpr::Segment
- Inherits:
-
Object
- Object
- RegExpr::Segment
- Defined in:
- lib/regexpr.rb
Overview
any thing
Instance Attribute Summary collapse
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
-
.deepest ⇒ Object
can’t have any segment as value.
- .nooptimize ⇒ Object
-
.novalue ⇒ Object
can’t have any value.
- .optimize(v) ⇒ Object
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize(val) ⇒ Segment
constructor
A new instance of Segment.
- #names ⇒ Object
- #optimize ⇒ Object
- #to_r ⇒ Object
Constructor Details
#initialize(val) ⇒ Segment
Returns a new instance of Segment.
8 |
# File 'lib/regexpr.rb', line 8 def initialize( val) self.value= val end |
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
7 8 9 |
# File 'lib/regexpr.rb', line 7 def value @value end |
Class Method Details
.deepest ⇒ Object
can’t have any segment as value
27 28 29 30 31 |
# File 'lib/regexpr.rb', line 27 def deepest self.class_eval do def names() [] end end end |
.nooptimize ⇒ Object
43 44 45 46 47 |
# File 'lib/regexpr.rb', line 43 def nooptimize self.class_eval do def optimize() self end end end |
.novalue ⇒ Object
can’t have any value
34 35 36 37 38 39 40 41 |
# File 'lib/regexpr.rb', line 34 def novalue self.class_eval do def initialize() end def empty?() false end def to_r() '' end def optimize() self end end end |
Instance Method Details
#empty? ⇒ Boolean
10 |
# File 'lib/regexpr.rb', line 10 def empty?() self.value.nil? end |
#names ⇒ Object
11 |
# File 'lib/regexpr.rb', line 11 def names() @value.names.flatten.compact end |
#optimize ⇒ Object
13 14 15 16 |
# File 'lib/regexpr.rb', line 13 def optimize self.value= self.class.optimize self.value self end |
#to_r ⇒ Object
9 |
# File 'lib/regexpr.rb', line 9 def to_r() self.value.to_s end |