Class: RegexPath::Segment
Instance Attribute Summary collapse
-
#re ⇒ Object
readonly
Returns the value of attribute re.
Instance Method Summary collapse
- #==(rhs) ⇒ Object
- #=~(value) ⇒ Object
- #captured? ⇒ Boolean
- #eql?(rhs) ⇒ Boolean
-
#initialize(re, captured = false, negative = false) ⇒ Segment
constructor
A new instance of Segment.
- #negative? ⇒ Boolean
Constructor Details
Instance Attribute Details
#re ⇒ Object (readonly)
Returns the value of attribute re.
12 13 14 |
# File 'lib/regex_path.rb', line 12 def re @re end |
Instance Method Details
#==(rhs) ⇒ Object
41 42 43 |
# File 'lib/regex_path.rb', line 41 def == ( rhs ) eql?(rhs) end |
#=~(value) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/regex_path.rb', line 20 def =~ ( value ) match_data = @re.match(value) if negative? (match_data)? nil : (//.match value) else match_data end end |
#captured? ⇒ Boolean
29 30 31 |
# File 'lib/regex_path.rb', line 29 def captured? @captured end |
#eql?(rhs) ⇒ Boolean
37 38 39 |
# File 'lib/regex_path.rb', line 37 def eql? ( rhs ) @re.eql?(rhs.re) and @captured.eql?(rhs.captured?) end |
#negative? ⇒ Boolean
33 34 35 |
# File 'lib/regex_path.rb', line 33 def negative? @negative end |