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)


102
103
104
105
106
# File 'lib/kitchen/oven.rb', line 102

def bake_seconds
  @baked_at - @parsed_at
rescue NoMethodError
  nil
end

#baked!Object

Record that the input file has been baked



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

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)


84
85
86
87
88
# File 'lib/kitchen/oven.rb', line 84

def open_seconds
  @opened_at - @started_at
rescue NoMethodError
  nil
end

#opened!Object

Record that the input file has been opened



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

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)


93
94
95
96
97
# File 'lib/kitchen/oven.rb', line 93

def parse_seconds
  @parsed_at - @opened_at
rescue NoMethodError
  nil
end

#parsed!Object

Record that the input file has been parsed



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

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

#started!Object

Record that baking has started



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

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

#to_sString

Return the profile stats as a string

Returns:



119
120
121
122
123
124
125
126
# File 'lib/kitchen/oven.rb', line 119

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)


111
112
113
114
115
# File 'lib/kitchen/oven.rb', line 111

def write_seconds
  @written_at - @baked_at
rescue NoMethodError
  nil
end

#written!Object

Record that the output file has been written



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

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