Class: TokenHawk::CLI::Commands::Recent

Inherits:
Object
  • Object
show all
Includes:
Formatter
Defined in:
lib/token_hawk/cli/commands/recent.rb

Instance Method Summary collapse

Methods included from Formatter

#format_cost

Constructor Details

#initialize(options = {}) ⇒ Recent

Returns a new instance of Recent.



11
12
13
# File 'lib/token_hawk/cli/commands/recent.rb', line 11

def initialize(options = {})
  @options = options
end

Instance Method Details

#run ⇒ Object



15
16
17
18
# File 'lib/token_hawk/cli/commands/recent.rb', line 15

def run
  records = CallRecord.order(created_at: :desc).limit(limit)
  @options["format"] == "json" ? print_json(records) : print_table(records)
end