Class: Hotch::Memory::Report::Line

Inherits:
Struct
  • Object
show all
Defined in:
lib/hotch/memory.rb

Direct Known Subclasses

Total

Defined Under Namespace

Classes: Total

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#countObject

Returns the value of attribute count

Returns:

  • (Object)

    the current value of count



143
144
145
# File 'lib/hotch/memory.rb', line 143

def count
  @count
end

#filenameObject

Returns the value of attribute filename

Returns:

  • (Object)

    the current value of filename



143
144
145
# File 'lib/hotch/memory.rb', line 143

def filename
  @filename
end

#max_ageObject

Returns the value of attribute max_age

Returns:

  • (Object)

    the current value of max_age



143
144
145
# File 'lib/hotch/memory.rb', line 143

def max_age
  @max_age
end

#min_ageObject

Returns the value of attribute min_age

Returns:

  • (Object)

    the current value of min_age



143
144
145
# File 'lib/hotch/memory.rb', line 143

def min_age
  @min_age
end

#old_countObject

Returns the value of attribute old_count

Returns:

  • (Object)

    the current value of old_count



143
144
145
# File 'lib/hotch/memory.rb', line 143

def old_count
  @old_count
end

#total_ageObject

Returns the value of attribute total_age

Returns:

  • (Object)

    the current value of total_age



143
144
145
# File 'lib/hotch/memory.rb', line 143

def total_age
  @total_age
end

#total_memsizeObject

Returns the value of attribute total_memsize

Returns:

  • (Object)

    the current value of total_memsize



143
144
145
# File 'lib/hotch/memory.rb', line 143

def total_memsize
  @total_memsize
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



143
144
145
# File 'lib/hotch/memory.rb', line 143

def type
  @type
end

Class Method Details

.from_result(result, ignore_paths) ⇒ Object

[

[path, lineno, type],
[count, old_count, total_age, min_age, max_age, total_memsize]

]



149
150
151
152
153
154
# File 'lib/hotch/memory.rb', line 149

def self.from_result(result, ignore_paths)
  path, line, *args = result.flatten(1)
  return if ignore_paths.any? { |ip| ip == path || ip === path }
  filename = "#{strip_path(path || "?")}:#{line}"
  new(filename, *args)
end

Instance Method Details

#keyObject



156
157
158
# File 'lib/hotch/memory.rb', line 156

def key
  [filename, type]
end

#lengthsObject



165
166
167
# File 'lib/hotch/memory.rb', line 165

def lengths
  members.map { |member| self[member].to_s.size }
end

#puts(io, fmt) ⇒ Object



160
161
162
163
# File 'lib/hotch/memory.rb', line 160

def puts(io, fmt)
  send = method(:send)
  io.puts fmt % members.map(&send)
end

#sum(other) ⇒ Object



169
170
171
172
173
# File 'lib/hotch/memory.rb', line 169

def sum(other)
  other.to_a.each.with_index do |value, i|
    self[i] += value if Numeric === value
  end
end