class DomesticateMonkeys::Snapshot

Attributes

all_tracks[R]

The Snapshot’s data storage serves as a basis for other classes, such as View (which provides insight into the data storage), Report (which provides aggregate information about your application) and TrackExport (which generates a JSON file).

filtered_tracks[R]

The Snapshot’s data storage serves as a basis for other classes, such as View (which provides insight into the data storage), Report (which provides aggregate information about your application) and TrackExport (which generates a JSON file).

multi_tracks[R]

The Snapshot’s data storage serves as a basis for other classes, such as View (which provides insight into the data storage), Report (which provides aggregate information about your application) and TrackExport (which generates a JSON file).

Public Class Methods

new() click to toggle source
# File lib/domesticate_monkeys/constants/snapshot.rb, line 14
def initialize
  @all_tracks      = $DOMESTICATE_MONKEYS_TRACKS
  @filtered_tracks = filter_no_methods
  @multi_tracks    = select_multi_tracks
end

Public Instance Methods

filter_no_methods() click to toggle source
# File lib/domesticate_monkeys/constants/snapshot.rb, line 20
def filter_no_methods
  @all_tracks.filter { _1.include?(".") || _1.include?("#") }
end
inspect() click to toggle source
# File lib/domesticate_monkeys/constants/snapshot.rb, line 34
def inspect
  # Overwrite default behaviour, which returns – and thus often prints –
  # the values of the object's set instance variables, which is enormous
  # in the case of @all_tracks and @multi_tracks.
  to_s
end
select_multi_tracks() click to toggle source
# File lib/domesticate_monkeys/constants/snapshot.rb, line 24
def select_multi_tracks
  multis = @filtered_tracks.select { |_method, track| track.count > 1 }
  sort_tracks(multis)
end
sort_tracks(tracks) click to toggle source
# File lib/domesticate_monkeys/constants/snapshot.rb, line 29
def sort_tracks(tracks)
  sorted_array = tracks.sort_by   { |_method, track| -track.count }
  sorted_hash  = sorted_array.map { |_method, track| { _method => track } }.inject(&:merge)
end