Class: Avmtrf1::Forponto::User::Balance::MyBalance

Inherits:
Object
  • Object
show all
Defined in:
lib/avmtrf1/forponto/user/balance.rb

Defined Under Namespace

Classes: AttrConsumer

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(month) ⇒ MyBalance

Returns a new instance of MyBalance.


65
66
67
68
69
70
# File 'lib/avmtrf1/forponto/user/balance.rb', line 65

def initialize(month)
  @month = month
  @debito = AttrConsumer.new(self, false, month.debito)
  @credito = AttrConsumer.new(self, true, month.credito)
  @lost = false
end

Instance Attribute Details

#creditoObject

Returns the value of attribute credito.


63
64
65
# File 'lib/avmtrf1/forponto/user/balance.rb', line 63

def credito
  @credito
end

#debitoObject

Returns the value of attribute debito.


63
64
65
# File 'lib/avmtrf1/forponto/user/balance.rb', line 63

def debito
  @debito
end

#lostObject

Returns the value of attribute lost.


63
64
65
# File 'lib/avmtrf1/forponto/user/balance.rb', line 63

def lost
  @lost
end

#monthObject

Returns the value of attribute month.


63
64
65
# File 'lib/avmtrf1/forponto/user/balance.rb', line 63

def month
  @month
end

Instance Method Details

#after_triggerObject


72
73
74
# File 'lib/avmtrf1/forponto/user/balance.rb', line 72

def after_trigger
  credito.after_trigger - debito.after_trigger
end

#after_trigger_acumObject


76
77
78
# File 'lib/avmtrf1/forponto/user/balance.rb', line 76

def after_trigger_acum
  credito.after_trigger_acum - debito.after_trigger_acum
end

#consume(previous) ⇒ Object


88
89
90
91
# File 'lib/avmtrf1/forponto/user/balance.rb', line 88

def consume(previous)
  debito.consume_from_months(previous)
  credito.consume_from_months(previous)
end

#mark_lostObject


80
81
82
# File 'lib/avmtrf1/forponto/user/balance.rb', line 80

def mark_lost
  @lost = true
end

#to_sObject


84
85
86
# File 'lib/avmtrf1/forponto/user/balance.rb', line 84

def to_s
  month.to_s
end