class Petitest::Texts::TimesText

Attributes

finished_at[R]

@return [Time]

started_at[R]

@return [Time]

Public Class Methods

new( finished_at:, started_at: ) click to toggle source

@param finished_at [Time] @param started_at [Time]

# File lib/petitest/texts/times_text.rb, line 14
def initialize(
  finished_at:,
  started_at:
)
  @finished_at = finished_at
  @started_at = started_at
end

Public Instance Methods

to_s() click to toggle source

@note Override

# File lib/petitest/texts/times_text.rb, line 23
def to_s
  [
    heading,
    indent(body, 2),
  ].join("\n\n")
end

Private Instance Methods

body() click to toggle source

@return [String]

# File lib/petitest/texts/times_text.rb, line 33
def body
  [
    "Started:  #{started_at.iso8601(6)}",
    "Finished: #{finished_at.iso8601(6)}",
    "Total:    %.6fs" % (finished_at - started_at),
  ].join("\n")
end
heading() click to toggle source

@return [String]

# File lib/petitest/texts/times_text.rb, line 42
def heading
  "Times:"
end