Sha256: bc7e0e0471dde6c734272c6b1c91ab514503d5874fff770cc367bad34169f7e7

Contents?: true

Size: 1.47 KB

Versions: 2

Compression:

Stored size: 1.47 KB

Contents

#!/usr/bin/env ruby -w
# encoding: UTF-8
#
# = Account.rb -- The TaskJuggler III Project Management Software
#
# Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011
#               by Chris Schlaeger <chris@linux.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#


require 'PropertyTreeNode'
require 'AccountScenario'

class TaskJuggler

  # An Account is an object to record financial transactions. Alternatively, an
  # Account can just be a container for a set of Accounts. In this case it
  # cannot directly record any transactions.
  class Account < PropertyTreeNode

    def initialize(project, id, name, parent)
      super(project.resources, id, name, parent)
      project.addAccount(self)

      @data = Array.new(@project.scenarioCount, nil)
      @project.scenarioCount.times do |i|
        @data[i] = AccountScenario.new(self, i, @scenarioAttributes[i])
      end
    end

    # Many Account functions are scenario specific. These functions are
    # provided by the class AccountScenario. In case we can't find a
    # function called for the Account class we try to find it in
    # AccountScenario.
    def method_missing(func, scenarioIdx, *args)
      @data[scenarioIdx].method(func).call(*args)
    end

    # Return a reference to the _scenarioIdx_-th scenario.
    def scenario(scenarioIdx)
      return @data[scenarioIdx]
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
taskjuggler-0.0.10 lib/Account.rb
taskjuggler-0.0.9 lib/Account.rb