Class: StackProf::Report::StackCursor

Inherits:
Struct
  • Object
show all
Defined in:
lib/stackprof/report.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idxObject

Returns the value of attribute idx

Returns:

  • (Object)

    the current value of idx



98
99
100
# File 'lib/stackprof/report.rb', line 98

def idx
  @idx
end

#lengthObject

Returns the value of attribute length

Returns:

  • (Object)

    the current value of length



98
99
100
# File 'lib/stackprof/report.rb', line 98

def length
  @length
end

#rawObject

Returns the value of attribute raw

Returns:

  • (Object)

    the current value of raw



98
99
100
# File 'lib/stackprof/report.rb', line 98

def raw
  @raw
end

Instance Method Details

#<=>(other) ⇒ Object



111
112
113
114
115
116
117
118
119
120
121
# File 'lib/stackprof/report.rb', line 111

def <=>(other)
  i = 0
  while i < length && i < other.length
    if self[i] != other[i]
      return self[i] <=> other[i]
    end
    i += 1
  end

  return length <=> other.length
end

#[](i) ⇒ Object



103
104
105
106
107
108
109
# File 'lib/stackprof/report.rb', line 103

def [](i)
  if i >= length
    nil
  else
    raw[1 + idx + i]
  end
end

#weightObject



99
100
101
# File 'lib/stackprof/report.rb', line 99

def weight
  @weight ||= raw[1 + idx + length]
end