Sha256: df551167e6eb9e7d4b6bd7b4c98b91135806d16bb1c545c830885ee6e3979b31

Contents?: true

Size: 922 Bytes

Versions: 1

Compression:

Stored size: 922 Bytes

Contents

module TimeOverlap
  class Presenter

    def initialize(data, format = '%T%:z')
      @data   = data
      @format = format
    end

    def self.print(*args)
      new(*args).print
    end

    def print
      puts "Original:"
      puts "#{formated_time(@data[:original][:start])} - #{formated_time(@data[:original][:end])}"
      separator

      puts "Full overlap:"
      puts "#{formated_time(@data[:full_overlap][:start])} - #{formated_time(@data[:full_overlap][:end])}"
      separator

      puts "Overlap 1:"
      puts "#{formated_time(@data[:overlap_1][:start])} - #{formated_time(@data[:overlap_1][:end])}"
      separator

      puts "Overlap 2:"
      puts "#{formated_time(@data[:overlap_2][:start])} - #{formated_time(@data[:overlap_2][:end])}"

      @data
    end

    private

    def separator
      puts "_" * 40
    end

    def formated_time(time)
      time#.strftime("%T %:z")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
time_overlap-0.1.0 lib/time_overlap/presenter.rb