Class RegexPath::Segment
In: lib/regex_path.rb
Parent: Object

Methods

==   =~   captured?   eql?   negative?   new  

Attributes

re  [R] 

Public Class methods

[Source]

# File lib/regex_path.rb, line 14
    def initialize ( re, captured=false, negative=false )
      @re = Regexp.new(re)
      @captured = !!captured
      @negative = !!negative
    end

Public Instance methods

[Source]

# File lib/regex_path.rb, line 41
    def == ( rhs )
      eql?(rhs)
    end

[Source]

# 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

[Source]

# File lib/regex_path.rb, line 29
    def captured?
      @captured
    end

[Source]

# File lib/regex_path.rb, line 37
    def eql? ( rhs )
      @re.eql?(rhs.re) and @captured.eql?(rhs.captured?)
    end

[Source]

# File lib/regex_path.rb, line 33
    def negative?
      @negative
    end

[Validate]