Class: Kamome::Transformations::JigyoshoCsv

Inherits:
Object
  • Object
show all
Includes:
Extractor
Defined in:
lib/kamome/transformations/jigyosho_csv.rb

Overview

Transform a JIGYOSHO csv row to a Hash or others

Constant Summary

Constants included from Extractor

Extractor::POST_OFFICE_REG

Instance Method Summary collapse

Methods included from Extractor

extract_post_office_box, extract_street

Instance Method Details

#generate_detail_model(row) ⇒ Kamome::Models::Jigyosho

Generate an instance of Kamome::Models::Jigyosho from a JIGYOSHO csv row



22
23
24
25
# File 'lib/kamome/transformations/jigyosho_csv.rb', line 22

def generate_detail_model(row)
  attributes = generate_hash(row)
  ::Kamome::Models::Jigyosho.new(attributes)
end

#generate_hash(row) ⇒ Hash

Generate a Hash from a JIGYOSHO csv row

Returns:

  • (Hash)


15
16
17
18
# File 'lib/kamome/transformations/jigyosho_csv.rb', line 15

def generate_hash(row)
  validate_row!(row)
  transform(row)
end

#generate_model(row) ⇒ Kamome::Models::Address

Generate an instance of Kamome::Models::Address from a JIGYOSHO csv row



29
30
31
32
# File 'lib/kamome/transformations/jigyosho_csv.rb', line 29

def generate_model(row)
  attributes = extract(generate_hash(row))
  ::Kamome::Models::Address.new(attributes)
end