Module: Pacer::Filter::RangeFilter

Defined in:
lib/pacer/filter/range_filter.rb

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Object) triggers



27
28
29
# File 'lib/pacer/filter/range_filter.rb', line 27

def self.triggers
  [:range]
end

Instance Method Details

- (Object) begin=(n)



68
69
70
# File 'lib/pacer/filter/range_filter.rb', line 68

def begin=(n)
  @range = n..range.end
end

- (Object) end=(n)



72
73
74
# File 'lib/pacer/filter/range_filter.rb', line 72

def end=(n)
  @range = range.begin..n
end

- (Object) index=(index)



76
77
78
# File 'lib/pacer/filter/range_filter.rb', line 76

def index=(index)
  @range = index..index
end

- (Object) limit(n = nil)



31
32
33
34
35
36
37
38
39
# File 'lib/pacer/filter/range_filter.rb', line 31

def limit(n = nil)
  @limit = n
  if range.begin == -1
    @range = range.begin...n
  else
    @range = range.begin...(range.begin + n)
  end
  self
end

- (Object) limit=(n)



41
42
43
44
# File 'lib/pacer/filter/range_filter.rb', line 41

def limit=(n)
  limit n
  n
end

- (Object) offset(n = nil)



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/pacer/filter/range_filter.rb', line 46

def offset(n = nil)
  s = n
  s += 1 if range.begin == -1
  if range.end == -1
    @range = (range.begin + s)..-1
  elsif range.exclude_end?
    @range = (range.begin + s)...(range.end + n)
  else
    @range = (range.begin + s)..(range.end + n)
  end
  self
end

- (Object) offset=(n)



59
60
61
62
# File 'lib/pacer/filter/range_filter.rb', line 59

def offset=(n)
  offset n
  n
end

- (Object) range



80
81
82
# File 'lib/pacer/filter/range_filter.rb', line 80

def range
  @range ||= -1..-1
end

- (Object) range=(range)



64
65
66
# File 'lib/pacer/filter/range_filter.rb', line 64

def range=(range)
  @range = range
end