Class: Kitchen::Oven::BakeProfile

Inherits:
Object
  • Object
show all
Defined in:
lib/kitchen/oven.rb

Overview

Stats on baking

Instance Method Summary collapse

Instance Method Details

#bake_secondsFloat?

Return the number of seconds it took to bake the parsed file or nil if this info isn’t available.

Returns:

  • (Float, nil)


88
89
90
91
92
# File 'lib/kitchen/oven.rb', line 88

def bake_seconds
  @baked_at - @parsed_at
rescue NoMethodError
  nil
end

#baked!Object

Record that the input file has been baked



62
# File 'lib/kitchen/oven.rb', line 62

def baked!;   @baked_at = Time.now;   end

#open_secondsFloat?

Return the number of seconds it took to open the input file or nil if this info isn’t available.

Returns:

  • (Float, nil)


70
71
72
73
74
# File 'lib/kitchen/oven.rb', line 70

def open_seconds
  @opened_at - @started_at
rescue NoMethodError
  nil
end

#opened!Object

Record that the input file has been opened



56
# File 'lib/kitchen/oven.rb', line 56

def opened!;  @opened_at = Time.now;  end

#parse_secondsFloat?

Return the number of seconds it took to parse the input file after opening or nil if this info isn’t available.

Returns:

  • (Float, nil)


79
80
81
82
83
# File 'lib/kitchen/oven.rb', line 79

def parse_seconds
  @parsed_at - @opened_at
rescue NoMethodError
  nil
end

#parsed!Object

Record that the input file has been parsed



59
# File 'lib/kitchen/oven.rb', line 59

def parsed!;  @parsed_at = Time.now;  end

#started!Object

Record that baking has started



53
# File 'lib/kitchen/oven.rb', line 53

def started!; @started_at = Time.now; end

#to_sString

Return the profile stats as a string

Returns:



105
106
107
108
109
110
111
112
# File 'lib/kitchen/oven.rb', line 105

def to_s
  <<~STRING
    Open:  #{open_seconds || '??'} s
    Parse: #{parse_seconds || '??'} s
    Bake:  #{bake_seconds || '??'} s
    Write: #{write_seconds || '??'} s
  STRING
end

#write_secondsFloat?

Return the number of seconds it took to write the baked file or nil if this info isn’t available.

Returns:

  • (Float, nil)


97
98
99
100
101
# File 'lib/kitchen/oven.rb', line 97

def write_seconds
  @written_at - @baked_at
rescue NoMethodError
  nil
end

#written!Object

Record that the output file has been written



65
# File 'lib/kitchen/oven.rb', line 65

def written!; @written_at = Time.now; end