Class: Decent::AddHodling

Inherits:
Object
  • Object
show all
Defined in:
lib/decent/command/hodling/add_hodling.rb

Class Method Summary collapse

Class Method Details

.execute(args) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/decent/command/hodling/add_hodling.rb', line 3

def self.execute(args)
  cli      = HighLine.new
  nickname = cli.ask "What is the nickname of this hodling?", String
  address  = cli.ask "What is the address of this hodling?", String
  currency = cli.ask "What is the currency of this hodling?", String
  hodlings = Database[:holdings]

  hodlings.insert({
    nickname: nickname,
    address: address,
    currency: currency,
    balance: 0.00,
    created_at: DateTime.now,
    updated_at: DateTime.now
  })
end