Class: TaxJp::DepreciationRate
- Inherits:
-
Object
- Object
- TaxJp::DepreciationRate
- Defined in:
- lib/tax_jp/depreciation_rate.rb
Overview
減価償却率
Constant Summary collapse
Instance Attribute Summary collapse
-
#durable_years ⇒ Object
readonly
Returns the value of attribute durable_years.
-
#fixed_amount_rate ⇒ Object
readonly
Returns the value of attribute fixed_amount_rate.
-
#guaranteed_rate ⇒ Object
readonly
Returns the value of attribute guaranteed_rate.
-
#rate ⇒ Object
readonly
Returns the value of attribute rate.
-
#revised_rate ⇒ Object
readonly
Returns the value of attribute revised_rate.
-
#valid_from ⇒ Object
readonly
Returns the value of attribute valid_from.
-
#valid_until ⇒ Object
readonly
Returns the value of attribute valid_until.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(row) ⇒ DepreciationRate
constructor
A new instance of DepreciationRate.
Constructor Details
#initialize(row) ⇒ DepreciationRate
Returns a new instance of DepreciationRate.
14 15 16 17 18 19 20 21 22 |
# File 'lib/tax_jp/depreciation_rate.rb', line 14 def initialize(row) @valid_from = row[0] @valid_until = row[1] @durable_years = row[2] @fixed_amount_rate = row[3] @rate = row[4] @revised_rate = row[5] @guaranteed_rate = row[6] end |
Instance Attribute Details
#durable_years ⇒ Object (readonly)
Returns the value of attribute durable_years.
10 11 12 |
# File 'lib/tax_jp/depreciation_rate.rb', line 10 def durable_years @durable_years end |
#fixed_amount_rate ⇒ Object (readonly)
Returns the value of attribute fixed_amount_rate.
11 12 13 |
# File 'lib/tax_jp/depreciation_rate.rb', line 11 def fixed_amount_rate @fixed_amount_rate end |
#guaranteed_rate ⇒ Object (readonly)
Returns the value of attribute guaranteed_rate.
12 13 14 |
# File 'lib/tax_jp/depreciation_rate.rb', line 12 def guaranteed_rate @guaranteed_rate end |
#rate ⇒ Object (readonly)
Returns the value of attribute rate.
12 13 14 |
# File 'lib/tax_jp/depreciation_rate.rb', line 12 def rate @rate end |
#revised_rate ⇒ Object (readonly)
Returns the value of attribute revised_rate.
12 13 14 |
# File 'lib/tax_jp/depreciation_rate.rb', line 12 def revised_rate @revised_rate end |
#valid_from ⇒ Object (readonly)
Returns the value of attribute valid_from.
9 10 11 |
# File 'lib/tax_jp/depreciation_rate.rb', line 9 def valid_from @valid_from end |
#valid_until ⇒ Object (readonly)
Returns the value of attribute valid_until.
9 10 11 |
# File 'lib/tax_jp/depreciation_rate.rb', line 9 def valid_until @valid_until end |
Class Method Details
.find_all_by_date(date) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/tax_jp/depreciation_rate.rb', line 24 def self.find_all_by_date(date) date = TaxJp::Utils.convert_to_date(date) with_database do |db| sql = 'select * from depreciation_rates ' sql << 'where valid_from <= ? and valid_until >= ? ' sql << 'order by durable_years ' ret = [] db.execute(sql, [date, date]) do |row| ret << TaxJp::DepreciationRate.new(row) end ret end end |
.find_by_date_and_durable_years(date, durable_years) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/tax_jp/depreciation_rate.rb', line 40 def self.find_by_date_and_durable_years(date, durable_years) date = TaxJp::Utils.convert_to_date(date) with_database do |db| sql = 'select * from depreciation_rates ' sql << 'where valid_from <= ? and valid_until >= ? ' sql << ' and durable_years = ? ' ret = nil db.execute(sql, [date, date, durable_years]) do |row| ret = TaxJp::DepreciationRate.new(row) end ret end end |