Class: Uttk::Filters::RPathFilter::Matcher
- Defined in:
- lib/uttk/filters/RPathFilter.rb
Defined Under Namespace
Classes: Disable
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
-
#buffer ⇒ Object
Returns the value of attribute buffer.
-
#re ⇒ Object
Returns the value of attribute re.
Instance Method Summary collapse
- #[](obj, *args) ⇒ Object
- #active? ⇒ Boolean
- #have_a_star? ⇒ Boolean
-
#initialize(aRegexPath, aMethod = nil, &block) ⇒ Matcher
constructor
A new instance of Matcher.
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
#block ⇒ Object
Returns the value of attribute block.
83 84 85 |
# File 'lib/uttk/filters/RPathFilter.rb', line 83 def block @block end |
#buffer ⇒ Object
Returns the value of attribute buffer.
83 84 85 |
# File 'lib/uttk/filters/RPathFilter.rb', line 83 def buffer @buffer end |
#re ⇒ Object
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
101 102 103 |
# File 'lib/uttk/filters/RPathFilter.rb', line 101 def active? @active end |
#have_a_star? ⇒ Boolean
97 98 99 |
# File 'lib/uttk/filters/RPathFilter.rb', line 97 def have_a_star? @have_a_star end |