Class: Avmtrf1::Forponto::User::Month
- Inherits:
-
Object
- Object
- Avmtrf1::Forponto::User::Month
- Defined in:
- lib/avmtrf1/forponto/user/month.rb
Constant Summary collapse
- DEBITO_CODE =
66- CREDITO_CODE =
72
Instance Attribute Summary collapse
-
#month ⇒ Object
readonly
Returns the value of attribute month.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
-
#year ⇒ Object
readonly
Returns the value of attribute year.
Instance Method Summary collapse
- #credito ⇒ Object
- #credito_acum ⇒ Object
- #data_uncached ⇒ Object
- #debito ⇒ Object
- #debito_acum ⇒ Object
- #debito_acumulado ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(user, year, month) ⇒ Month
constructor
A new instance of Month.
- #saldo ⇒ Object
- #saldo_acum ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(user, year, month) ⇒ Month
Returns a new instance of Month.
22 23 24 25 26 |
# File 'lib/avmtrf1/forponto/user/month.rb', line 22 def initialize(user, year, month) @user = user @year = year @month = month end |
Instance Attribute Details
#month ⇒ Object (readonly)
Returns the value of attribute month.
20 21 22 |
# File 'lib/avmtrf1/forponto/user/month.rb', line 20 def month @month end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
20 21 22 |
# File 'lib/avmtrf1/forponto/user/month.rb', line 20 def user @user end |
#year ⇒ Object (readonly)
Returns the value of attribute year.
20 21 22 |
# File 'lib/avmtrf1/forponto/user/month.rb', line 20 def year @year end |
Instance Method Details
#credito ⇒ Object
68 69 70 |
# File 'lib/avmtrf1/forponto/user/month.rb', line 68 def credito summary_minutes(CREDITO_CODE) end |
#credito_acum ⇒ Object
56 57 58 |
# File 'lib/avmtrf1/forponto/user/month.rb', line 56 def credito_acum credito + (parent_month ? parent_month.credito_acum : 0) end |
#data_uncached ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/avmtrf1/forponto/user/month.rb', line 28 def data_uncached if recache? r = fresh_data data_cache.write(r.to_yaml) r else cached_data end end |
#debito ⇒ Object
48 49 50 |
# File 'lib/avmtrf1/forponto/user/month.rb', line 48 def debito summary_minutes(DEBITO_CODE) end |
#debito_acum ⇒ Object
52 53 54 |
# File 'lib/avmtrf1/forponto/user/month.rb', line 52 def debito_acum debito + (parent_month ? parent_month.debito_acum : 0) end |
#debito_acumulado ⇒ Object
46 |
# File 'lib/avmtrf1/forponto/user/month.rb', line 46 def debito_acumulado; end |
#empty? ⇒ Boolean
42 43 44 |
# File 'lib/avmtrf1/forponto/user/month.rb', line 42 def empty? os_data.summaries.empty? end |
#saldo ⇒ Object
60 61 62 |
# File 'lib/avmtrf1/forponto/user/month.rb', line 60 def saldo credito - debito end |
#saldo_acum ⇒ Object
64 65 66 |
# File 'lib/avmtrf1/forponto/user/month.rb', line 64 def saldo_acum credito_acum - debito_acum end |
#to_s ⇒ Object
38 39 40 |
# File 'lib/avmtrf1/forponto/user/month.rb', line 38 def to_s month.to_s.rjust(2, '0') + '/' + year.to_s end |