module Grably::Core::ApplicationEnchancer
Wraps top_level
method. To hook start/finish
Public Class Methods
included(other_class)
click to toggle source
# File lib/grably/core/app/enchancer.rb, line 6 def included(other_class) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength other_class.class_eval do alias_method :old_top, :top_level def top_level(*_args) puts 'Building profile '.yellow.bright + c.profile.join('/') if Grably.export? old_top export(Grably.export_path) else measure_time { old_top } end end end end
top_level(*_args)
click to toggle source
# File lib/grably/core/app/enchancer.rb, line 10 def top_level(*_args) puts 'Building profile '.yellow.bright + c.profile.join('/') if Grably.export? old_top export(Grably.export_path) else measure_time { old_top } end end
Public Instance Methods
export(path)
click to toggle source
# File lib/grably/core/app/enchancer.rb, line 23 def export(path) return unless path save_obj(Grably.export_path, Grably.exports) end
measure_time() { || ... }
click to toggle source
# File lib/grably/core/app/enchancer.rb, line 28 def measure_time ts = Time.now yield te = Time.now puts "Total time: #{te - ts} seconds (#{ts} -> #{te})".yellow.bright end