Sha256: c3868745e0699db93ef6c10c316da20abf9178633ccd929f9633eec3d11c130f

Contents?: true

Size: 775 Bytes

Versions: 9

Compression:

Stored size: 775 Bytes

Contents

module Burglar
  ##
  # Single bank's information
  class Bank
    def initialize(params = {})
      @options = params
      extend module_obj
    end

    def transactions
      Ledger.new(entries: raw_transactions)
    end

    def begin_date
      @begin_date ||= @options[:begin]
    end

    def end_date
      @end_date ||= @options[:end]
    end

    private

    def account_name
      @account_name ||= @options[:account] || default_account_name
    end

    def default_account_name
      raise('Module failed to override default_account_name')
    end

    def type
      @type ||= @options[:type] || raise('Must supply an account type')
    end

    def module_obj
      @module_obj ||= Burglar.modules.find(type) || raise("No module: #{type}")
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
burglar-0.3.0 lib/burglar/bank.rb
burglar-0.2.0 lib/burglar/bank.rb
burglar-0.1.4 lib/burglar/bank.rb
burglar-0.1.3 lib/burglar/bank.rb
burglar-0.1.2 lib/burglar/bank.rb
burglar-0.1.1 lib/burglar/bank.rb
burglar-0.1.0 lib/burglar/bank.rb
burglar-0.0.3 lib/burglar/bank.rb
burglar-0.0.2 lib/burglar/bank.rb