Class: DoubleEntry::BalanceCalculator::Options Private

Inherits:
Object
  • Object
show all
Defined in:
lib/double_entry/balance_calculator.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(account, args = {}) ⇒ Options

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Options.



54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/double_entry/balance_calculator.rb', line 54

def initialize(, args = {})
  if .is_a? Symbol
    @account = .to_s
    @scope = args[:scope].present? ? args[:scope].id.to_s : nil
  else
    @account = .identifier.to_s
    @scope = .scope_identity
  end
  @codes = (args[:codes].to_a << args[:code]).compact
  @from = args[:from]
  @to = args[:to]
  @at = args[:at]
end

Instance Attribute Details

#accountObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



52
53
54
# File 'lib/double_entry/balance_calculator.rb', line 52

def 
  @account
end

#atObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



52
53
54
# File 'lib/double_entry/balance_calculator.rb', line 52

def at
  @at
end

#codesObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



52
53
54
# File 'lib/double_entry/balance_calculator.rb', line 52

def codes
  @codes
end

#fromObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



52
53
54
# File 'lib/double_entry/balance_calculator.rb', line 52

def from
  @from
end

#scopeObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



52
53
54
# File 'lib/double_entry/balance_calculator.rb', line 52

def scope
  @scope
end

#toObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



52
53
54
# File 'lib/double_entry/balance_calculator.rb', line 52

def to
  @to
end

Instance Method Details

#at?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


68
69
70
# File 'lib/double_entry/balance_calculator.rb', line 68

def at?
  !!at
end

#between?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


72
73
74
# File 'lib/double_entry/balance_calculator.rb', line 72

def between?
  !!(from && to && !at?)
end

#code?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


76
77
78
# File 'lib/double_entry/balance_calculator.rb', line 76

def code?
  codes.present?
end

#scope?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


80
81
82
# File 'lib/double_entry/balance_calculator.rb', line 80

def scope?
  !!scope
end