Class: A14z6chElapsedDays::Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/a14z6ch_elapsed_days.rb

Instance Method Summary collapse

Instance Method Details

#between(from, to) ⇒ Object


42
43
44
45
46
47
48
49
50
51
52
# File 'lib/a14z6ch_elapsed_days.rb', line 42

def between(from, to)
  begin
    puts "#{calc(from, to).to_s(:delimited)} days elapsed from the day \"#{from}\" to \"#{to}\".".colorize(:light_magenta)
  rescue ArgumentError => e
    if e.message.nil?
      puts "given date is not valid.".colorize(:light_blue)
    else
      puts e.message.colorize(:light_blue)
    end
  end
end

#from(date) ⇒ Object

calculating method

Parameters:

  • from

    date


26
27
28
29
30
31
32
33
34
35
36
# File 'lib/a14z6ch_elapsed_days.rb', line 26

def from(date)
  begin
    puts "#{calc(date, Time.now.to_s).to_s(:delimited)} days elapsed from the day \"#{date}\" to NOW.".colorize(:light_magenta)
  rescue ArgumentError => e
    if e.message.nil?
      puts "given date is not valid.".colorize(:light_blue)
    else
      puts e.message.colorize(:light_blue)
    end
  end
end

#versionObject


17
18
19
# File 'lib/a14z6ch_elapsed_days.rb', line 17

def version
  puts "a14z6ch appilication version : #{A14z6chElapsedDays::VERSION}"
end