Module: Bitshares

Defined in:
lib/bitshares.rb,
lib/bitshares/client.rb,
lib/bitshares/market.rb,
lib/bitshares/trader.rb,
lib/bitshares/wallet.rb,
lib/bitshares/account.rb,
lib/bitshares/version.rb,
lib/bitshares/blockchain.rb

Overview

stackoverflow.com/questions/6233124/where-to-place-access-config-file-in-gem

Defined Under Namespace

Classes: Account, Blockchain, Client, Market, Trader, Wallet

Constant Summary collapse

VERSION =
'0.1.5'

Class Method Summary collapse

Class Method Details

.configObject



43
44
45
# File 'lib/bitshares.rb', line 43

def self.config
  @config
end

.configure(opts = {}) ⇒ Object



25
26
27
# File 'lib/bitshares.rb', line 25

def self.configure(opts = {})
  opts.each {|k,v| @config[k.to_sym] = v if @valid_keys.include? k.to_sym}
end

.configure_with(path_to_yaml_file) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/bitshares.rb', line 29

def self.configure_with(path_to_yaml_file)
  begin
    config = YAML::load(IO.read(path_to_yaml_file))
  rescue Errno::ENOENT
    puts "YAML configuration file couldn\'t be found. Using defaults"
    return
  rescue Psych::SyntaxError
    puts 'YAML configuration file contains invalid syntax. Using defaults'
    return
  end

  configure(config)
end