Module: Lytix::Configuration

Defined in:
lib/lytix/configuration.rb

Class Method Summary collapse

Class Method Details

.account(*args, &block) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/lytix/configuration.rb', line 8

def (*args, &block)
  value = (args.size > 1 ? args : args.first)
  new_accounts = case value
    when Array then value.inject([]){|a,v| a += (v) }
    when String then [Account.new(value)]
    when Hash then value.map{|k,v| Account.new(v, k) }
  end

  new_accounts.each{|a| block.bind(a).call } if block_given?

  accounts
  @accounts += new_accounts
end

.accountsObject



4
5
6
# File 'lib/lytix/configuration.rb', line 4

def accounts
  @accounts ||= []
end