Class: Pacer::Filter::SectionFilter::FilterSectionPipe

Inherits:
Pipes::RubyPipe
  • Object
show all
Defined in:
lib/pacer/filter/object_filter.rb

Instance Attribute Summary collapse

Attributes inherited from Pipes::RubyPipe

#starts

Instance Method Summary collapse

Methods inherited from Pipes::RubyPipe

#enablePath, #setStarts

Constructor Details

#initialize(section, negate) ⇒ FilterSectionPipe

Returns a new instance of FilterSectionPipe.



77
78
79
80
81
82
# File 'lib/pacer/filter/object_filter.rb', line 77

def initialize(section, negate)
  super()
  @section = section
  @negate = negate
  section.visitor = self if section
end

Instance Attribute Details

#negateObject (readonly)

Returns the value of attribute negate.



74
75
76
# File 'lib/pacer/filter/object_filter.rb', line 74

def negate
  @negate
end

#otherObject

Returns the value of attribute other.



75
76
77
# File 'lib/pacer/filter/object_filter.rb', line 75

def other
  @other
end

#sectionObject (readonly)

Returns the value of attribute section.



74
75
76
# File 'lib/pacer/filter/object_filter.rb', line 74

def section
  @section
end

Instance Method Details

#on_raw_element(x) ⇒ Object



98
99
100
# File 'lib/pacer/filter/object_filter.rb', line 98

def on_raw_element(x)
  self.other = x
end

#processNextStartObject



84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/pacer/filter/object_filter.rb', line 84

def processNextStart
  value = starts.next
  if negate
    while value == other
      value = starts.next
    end
  else
    while value != other
      value = starts.next
    end
  end
  value
end

#resetObject



102
103
104
105
# File 'lib/pacer/filter/object_filter.rb', line 102

def reset
  self.other = nil
  super
end