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.



53
54
55
56
57
58
59
60
# File 'lib/double_entry/balance_calculator.rb', line 53

def initialize(, args = {})
  @account = .identifier.to_s
  @scope = .scope_identity
  @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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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)


62
63
64
# File 'lib/double_entry/balance_calculator.rb', line 62

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)


66
67
68
# File 'lib/double_entry/balance_calculator.rb', line 66

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)


70
71
72
# File 'lib/double_entry/balance_calculator.rb', line 70

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)


74
75
76
# File 'lib/double_entry/balance_calculator.rb', line 74

def scope?
  !!scope
end