Sha256: 6078f6981f8e238827ee307f7ddb6a7524d03a4b6050342e0091fc99b57d9c23

Contents?: true

Size: 317 Bytes

Versions: 2

Compression:

Stored size: 317 Bytes

Contents

module ConferenceTracker
  class Duration
    SECS_IN_MIN = 60
    UNITS = {
      "lightning" => 5
    }

    def initialize(value)
      @value = UNITS.fetch(value, value).to_i
    end

    def to_i
      @value * SECS_IN_MIN
    end

    def to_s
      UNITS.invert.fetch(@value, "#{@value}min")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
conference_tracker-1.1.1 lib/conference_tracker/duration.rb
conference_tracker-1.1.0 lib/conference_tracker/duration.rb