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 account(*args, &block) value = (args.size > 1 ? args : args.first) new_accounts = case value when Array then value.inject([]){|a,v| a += account(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 |
.accounts ⇒ Object
4 5 6 |
# File 'lib/lytix/configuration.rb', line 4 def accounts @accounts ||= [] end |