Class: ContractLtd::Dividend
- Inherits:
-
Object
- Object
- ContractLtd::Dividend
- Defined in:
- lib/contract_ltd/dividend.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#article ⇒ Object
readonly
Returns the value of attribute article.
-
#company_year_end ⇒ Object
readonly
Returns the value of attribute company_year_end.
-
#gross ⇒ Object
readonly
Returns the value of attribute gross.
-
#net ⇒ Object
readonly
Returns the value of attribute net.
-
#shares ⇒ Object
readonly
Returns the value of attribute shares.
-
#tax_credit ⇒ Object
readonly
Returns the value of attribute tax_credit.
-
#tax_year_end ⇒ Object
readonly
Returns the value of attribute tax_year_end.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #date_paid(format = :long) ⇒ Object
- #filename ⇒ Object
-
#initialize(args) ⇒ Dividend
constructor
A new instance of Dividend.
- #name(ext) ⇒ Object
Constructor Details
#initialize(args) ⇒ Dividend
Returns a new instance of Dividend.
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/contract_ltd/dividend.rb', line 5 def initialize args @name = 'dividend' @type = ARGV[0] @article = @type == 'final' ? 'a' : 'an' @date_paid = Date.parse(ARGV[1]) @tax_year_end = Date.new(ARGV[2].to_i, 4, 5).to_s(:long) @shares = 100 @net = ARGV[3].to_f @tax_credit = @net * 0.111111 @gross = @net + @tax_credit @amount = @net / @shares @company_year_end = Date.new(ARGV[4].to_i, 2, 28).to_s(:long) end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
3 4 5 |
# File 'lib/contract_ltd/dividend.rb', line 3 def amount @amount end |
#article ⇒ Object (readonly)
Returns the value of attribute article.
3 4 5 |
# File 'lib/contract_ltd/dividend.rb', line 3 def article @article end |
#company_year_end ⇒ Object (readonly)
Returns the value of attribute company_year_end.
3 4 5 |
# File 'lib/contract_ltd/dividend.rb', line 3 def company_year_end @company_year_end end |
#gross ⇒ Object (readonly)
Returns the value of attribute gross.
3 4 5 |
# File 'lib/contract_ltd/dividend.rb', line 3 def gross @gross end |
#net ⇒ Object (readonly)
Returns the value of attribute net.
3 4 5 |
# File 'lib/contract_ltd/dividend.rb', line 3 def net @net end |
#shares ⇒ Object (readonly)
Returns the value of attribute shares.
3 4 5 |
# File 'lib/contract_ltd/dividend.rb', line 3 def shares @shares end |
#tax_credit ⇒ Object (readonly)
Returns the value of attribute tax_credit.
3 4 5 |
# File 'lib/contract_ltd/dividend.rb', line 3 def tax_credit @tax_credit end |
#tax_year_end ⇒ Object (readonly)
Returns the value of attribute tax_year_end.
3 4 5 |
# File 'lib/contract_ltd/dividend.rb', line 3 def tax_year_end @tax_year_end end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/contract_ltd/dividend.rb', line 3 def type @type end |
Instance Method Details
#date_paid(format = :long) ⇒ Object
19 20 21 |
# File 'lib/contract_ltd/dividend.rb', line 19 def date_paid(format = :long) @date_paid.to_s(format) end |
#filename ⇒ Object
27 28 29 |
# File 'lib/contract_ltd/dividend.rb', line 27 def filename "#{@name}_#{date_paid(:file)}.pdf" end |
#name(ext) ⇒ Object
23 24 25 |
# File 'lib/contract_ltd/dividend.rb', line 23 def name(ext) "#{@name}.#{ext}" end |