class HtmlSlicer::Helpers::Slicer::SliceProxy

Wraps a “slice number” and provides some utility methods

Public Instance Methods

+(other) click to toggle source
# File lib/html_slicer/helpers/slicer.rb, line 170
def +(other)
  to_i + other.to_i
end
-(other) click to toggle source
# File lib/html_slicer/helpers/slicer.rb, line 174
def -(other)
  to_i - other.to_i
end
<=>(other) click to toggle source
# File lib/html_slicer/helpers/slicer.rb, line 178
def <=>(other)
  to_i <=> other.to_i
end
current?() click to toggle source

current slice or not

# File lib/html_slicer/helpers/slicer.rb, line 118
def current?
  @slice == @options[:current_slice]
end
first?() click to toggle source

the first slice or not

# File lib/html_slicer/helpers/slicer.rb, line 123
def first?
  @slice == 1
end
inside_window?() click to toggle source

inside the inner window or not

# File lib/html_slicer/helpers/slicer.rb, line 153
def inside_window?
  (@options[:current_slice] - @slice).abs <= @options[:window]
end
last?() click to toggle source

the last slice or not

# File lib/html_slicer/helpers/slicer.rb, line 128
def last?
  @slice == @options[:slice_number]
end
left_outer?() click to toggle source

within the left outer window or not

# File lib/html_slicer/helpers/slicer.rb, line 143
def left_outer?
  @slice <= @options[:left]
end
next?() click to toggle source

the next slice or not

# File lib/html_slicer/helpers/slicer.rb, line 138
def next?
  @slice == @options[:current_slice] + 1
end
number() click to toggle source

the slice number

# File lib/html_slicer/helpers/slicer.rb, line 113
def number
  @slice
end
prev?() click to toggle source

the previous slice or not

# File lib/html_slicer/helpers/slicer.rb, line 133
def prev?
  @slice == @options[:current_slice] - 1
end
right_outer?() click to toggle source

within the right outer window or not

# File lib/html_slicer/helpers/slicer.rb, line 148
def right_outer?
  @options[:slice_number] - @slice < @options[:right]
end
to_i() click to toggle source
# File lib/html_slicer/helpers/slicer.rb, line 162
def to_i
  number
end
to_s() click to toggle source
# File lib/html_slicer/helpers/slicer.rb, line 166
def to_s
  number.to_s
end
was_truncated?() click to toggle source

The last rendered tag was “truncated” or not

# File lib/html_slicer/helpers/slicer.rb, line 158
def was_truncated?
  @last.is_a? Gap
end