Class: Abrasf::Desif::TaxCodeToCity

Inherits:
Object
  • Object
show all
Defined in:
lib/abrasf/desif/tax_code_to_city.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(city_id, since, default_codes) ⇒ TaxCodeToCity

Returns a new instance of TaxCodeToCity.



12
13
14
15
16
# File 'lib/abrasf/desif/tax_code_to_city.rb', line 12

def initialize(city_id, since, default_codes)
  @city_id = city_id
  @since = since
  @default_codes = default_codes
end

Class Method Details

.create(opt) ⇒ Object



6
7
8
9
10
# File 'lib/abrasf/desif/tax_code_to_city.rb', line 6

def self.create(opt)
  opt = { city_id: nil, since: Date.today, codes: TaxCode }.merge opt

  new(opt[:city_id], opt[:since], opt[:codes]).create
end

Instance Method Details

#createObject



18
19
20
# File 'lib/abrasf/desif/tax_code_to_city.rb', line 18

def create
  codes { |code_id| CityTaxCode.create! attributes(code_id) }
end