Module: Mcoin::Command::Saveable

Included in:
Ticker
Defined in:
lib/mcoin/command/ext/saveable.rb

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/mcoin/command/ext/saveable.rb', line 7

def self.included(base)
  base.class_eval do
    option(:single, :endpoint, '-e',
           '--endpoint ENDPOINT', URI, 'Database Endpoint')
    option(:single, :database, '-d',
           '--database NAME', String, 'Database Name')
    option(:single, :username, '-u',
           '--username USERNAME', String, 'Database Username')
    option(:single, :password, '-p',
           '--password PASSWORD', String, 'Database Password')
  end
end

Instance Method Details

#databaseObject



24
25
26
27
28
29
30
31
# File 'lib/mcoin/command/ext/saveable.rb', line 24

def database
  InfluxDB.new(
    option.endpoint,
    option.database,
    option.username,
    option.password
  )
end

#save?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/mcoin/command/ext/saveable.rb', line 20

def save?
  option.endpoint && option.database
end