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.
21 22 23 24 25 |
# File 'lib/avmtrf1/forponto/user/month.rb', line 21 def initialize(user, year, month) @user = user @year = year @month = month end |
Instance Attribute Details
#month ⇒ Object (readonly)
Returns the value of attribute month.
19 20 21 |
# File 'lib/avmtrf1/forponto/user/month.rb', line 19 def month @month end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
19 20 21 |
# File 'lib/avmtrf1/forponto/user/month.rb', line 19 def user @user end |
#year ⇒ Object (readonly)
Returns the value of attribute year.
19 20 21 |
# File 'lib/avmtrf1/forponto/user/month.rb', line 19 def year @year end |
Instance Method Details
#credito ⇒ Object
67 68 69 |
# File 'lib/avmtrf1/forponto/user/month.rb', line 67 def credito summary_minutes(CREDITO_CODE) end |
#credito_acum ⇒ Object
55 56 57 |
# File 'lib/avmtrf1/forponto/user/month.rb', line 55 def credito_acum credito + (parent_month ? parent_month.credito_acum : 0) end |
#data_uncached ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/avmtrf1/forponto/user/month.rb', line 27 def data_uncached if recache? r = fresh_data data_cache.write(r.to_yaml) r else cached_data end end |
#debito ⇒ Object
47 48 49 |
# File 'lib/avmtrf1/forponto/user/month.rb', line 47 def debito summary_minutes(DEBITO_CODE) end |
#debito_acum ⇒ Object
51 52 53 |
# File 'lib/avmtrf1/forponto/user/month.rb', line 51 def debito_acum debito + (parent_month ? parent_month.debito_acum : 0) end |
#debito_acumulado ⇒ Object
45 |
# File 'lib/avmtrf1/forponto/user/month.rb', line 45 def debito_acumulado; end |
#empty? ⇒ Boolean
41 42 43 |
# File 'lib/avmtrf1/forponto/user/month.rb', line 41 def empty? os_data.summaries.empty? end |
#saldo ⇒ Object
59 60 61 |
# File 'lib/avmtrf1/forponto/user/month.rb', line 59 def saldo credito - debito end |
#saldo_acum ⇒ Object
63 64 65 |
# File 'lib/avmtrf1/forponto/user/month.rb', line 63 def saldo_acum credito_acum - debito_acum end |
#to_s ⇒ Object
37 38 39 |
# File 'lib/avmtrf1/forponto/user/month.rb', line 37 def to_s month.to_s.rjust(2, '0') + '/' + year.to_s # rubocop:disable Style/StringConcatenation end |