class Roo::Excelx::Cell::Time

Attributes

cell_value[R]
coordinate[R]
format[R]
formula[R]
value[R]

Public Class Methods

new(value, formula, excelx_type, style, link, base_date, coordinate) click to toggle source
Calls superclass method Roo::Excelx::Cell::DateTime::new
# File lib/roo/excelx/cell/time.rb, line 11
def initialize(value, formula, excelx_type, style, link, base_date, coordinate)
  # NOTE: Pass all arguments to DateTime super class.
  super
  @format = excelx_type.last
  @datetime = create_datetime(base_date, value)
  @value = link ? Roo::Link.new(link, value) : (value.to_f * 86_400).round.to_i
end

Public Instance Methods

formatted_value() click to toggle source
# File lib/roo/excelx/cell/time.rb, line 19
def formatted_value
  formatter = @format.gsub(/#{TIME_FORMATS.keys.join('|')}/, TIME_FORMATS)
  @datetime.strftime(formatter)
end
Also aliased as: to_s
to_s()
Alias for: formatted_value