class Rsummary::Command

Public Class Methods

new(num=100) click to toggle source
# File lib/rsummary/command.rb, line 9
def initialize(num=100)
  @num = num
  @cnt = 0
  @json = load_json
end

Public Instance Methods

history() click to toggle source
# File lib/rsummary/command.rb, line 15
def history
  json_obj.each do |k, v|
    break if limit?
    @cnt += 1

    puts "\n"
    puts "Date: #{Time.at(k.to_i).strftime('%Y-%m-%d %H:%M:%S')}".yellow
    puts v['fully_formatted'].gsub("\n", "\n\t")
  end
end
remove() click to toggle source
# File lib/rsummary/command.rb, line 26
def remove
  delete_file
end
status() click to toggle source
# File lib/rsummary/command.rb, line 30
def status
  return if json_obj.empty?

  Rsummary::Status.new(json_obj).out
end

Private Instance Methods

json_obj() click to toggle source
# File lib/rsummary/command.rb, line 42
def json_obj
  @json.to_h
end
limit?() click to toggle source
# File lib/rsummary/command.rb, line 38
def limit?
  @num <= @cnt
end