Class: Uttk::Filters::RPathFilter::Matcher

Inherits:
Object
  • Object
show all
Defined in:
lib/uttk/filters/RPathFilter.rb

Defined Under Namespace

Classes: Disable

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(aRegexPath, aMethod = nil, &block) ⇒ Matcher

Returns a new instance of Matcher.



88
89
90
91
92
93
94
95
# File 'lib/uttk/filters/RPathFilter.rb', line 88

def initialize ( aRegexPath, aMethod=nil, &block )
  @re = aRegexPath
  @re = RegexPath.new(@re) unless @re.is_a? RegexPath
  @block = aMethod || block
  @have_a_star = @re.segments.any? { |x| x.captured? }
  @buffer = Filters::Buffer.new
  @active = true
end

Instance Attribute Details

#blockObject

Returns the value of attribute block.



83
84
85
# File 'lib/uttk/filters/RPathFilter.rb', line 83

def block
  @block
end

#bufferObject

Returns the value of attribute buffer.



83
84
85
# File 'lib/uttk/filters/RPathFilter.rb', line 83

def buffer
  @buffer
end

#reObject

Returns the value of attribute re.



83
84
85
# File 'lib/uttk/filters/RPathFilter.rb', line 83

def re
  @re
end

Instance Method Details

#[](obj, *args) ⇒ Object



105
106
107
108
109
110
111
112
113
114
115
# File 'lib/uttk/filters/RPathFilter.rb', line 105

def [] ( obj, *args )
  begin
    if @block.is_a? Symbol
      obj.send(@block, *args)
    else
      @block[obj, *args]
    end
  rescue Disable
    @active = false
  end
end

#active?Boolean

Returns:

  • (Boolean)


101
102
103
# File 'lib/uttk/filters/RPathFilter.rb', line 101

def active?
  @active
end

#have_a_star?Boolean

Returns:

  • (Boolean)


97
98
99
# File 'lib/uttk/filters/RPathFilter.rb', line 97

def have_a_star?
  @have_a_star
end