Class: DomesticateMonkeys::Report
- Inherits:
-
Object
- Object
- DomesticateMonkeys::Report
- Defined in:
- lib/domesticate_monkeys/constants/report.rb
Instance Attribute Summary collapse
-
#all_tracks ⇒ Object
readonly
Returns the value of attribute all_tracks.
-
#method_count ⇒ Object
readonly
Returns the value of attribute method_count.
-
#multi_tracks ⇒ Object
readonly
Returns the value of attribute multi_tracks.
-
#redefined_method_count ⇒ Object
readonly
Returns the value of attribute redefined_method_count.
-
#snapshot ⇒ Object
readonly
Returns the value of attribute snapshot.
Instance Method Summary collapse
- #boot_information ⇒ Object
-
#initialize ⇒ Report
constructor
A new instance of Report.
- #inspect ⇒ Object
- #top_redefinitions(top_amount = 3) ⇒ Object
Constructor Details
#initialize ⇒ Report
Returns a new instance of Report.
7 8 9 10 11 12 13 14 |
# File 'lib/domesticate_monkeys/constants/report.rb', line 7 def initialize @snapshot = Snapshot.new @all_tracks = @snapshot.all_tracks @multi_tracks = @snapshot.multi_tracks @method_count = @all_tracks.size @redefined_method_count = @multi_tracks.size end |
Instance Attribute Details
#all_tracks ⇒ Object (readonly)
Returns the value of attribute all_tracks.
5 6 7 |
# File 'lib/domesticate_monkeys/constants/report.rb', line 5 def all_tracks @all_tracks end |
#method_count ⇒ Object (readonly)
Returns the value of attribute method_count.
5 6 7 |
# File 'lib/domesticate_monkeys/constants/report.rb', line 5 def method_count @method_count end |
#multi_tracks ⇒ Object (readonly)
Returns the value of attribute multi_tracks.
5 6 7 |
# File 'lib/domesticate_monkeys/constants/report.rb', line 5 def multi_tracks @multi_tracks end |
#redefined_method_count ⇒ Object (readonly)
Returns the value of attribute redefined_method_count.
5 6 7 |
# File 'lib/domesticate_monkeys/constants/report.rb', line 5 def redefined_method_count @redefined_method_count end |
#snapshot ⇒ Object (readonly)
Returns the value of attribute snapshot.
5 6 7 |
# File 'lib/domesticate_monkeys/constants/report.rb', line 5 def snapshot @snapshot end |
Instance Method Details
#boot_information ⇒ Object
23 24 25 26 27 28 |
# File 'lib/domesticate_monkeys/constants/report.rb', line 23 def boot_information plain_text = "It took domesticate_monkeys #{$BOOT_TIME} seconds to analyse your application,"\ " which defined #{$DOMESTICATE_MONKEYS_COUNT} methods." colored_text = "\e[#{35}m#{plain_text}\e[0m" puts colored_text end |
#inspect ⇒ Object
30 31 32 33 34 35 |
# File 'lib/domesticate_monkeys/constants/report.rb', line 30 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 |
#top_redefinitions(top_amount = 3) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/domesticate_monkeys/constants/report.rb', line 16 def top_redefinitions(top_amount = 3) puts "Showing top #{top_amount} redefinitions:" tracks = @multi_tracks.first(top_amount).to_h.values tracks.each(&:print) nil end |