Class: DeclarativeMapper

Inherits:
Object
  • Object
show all
Defined in:
lib/declarative_mapper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client_path) ⇒ DeclarativeMapper

Returns a new instance of DeclarativeMapper.



6
7
8
9
10
11
12
13
# File 'lib/declarative_mapper.rb', line 6

def initialize(client_path)
  @client_path = client_path
  @client_name = client_path.split('/').last
  @project_path = client_path.sub("/#{@client_name}", '')

  require_client_mapper_methods
  require_shared_mapper_methods
end

Instance Attribute Details

#client_nameObject (readonly)

Returns the value of attribute client_name.



4
5
6
# File 'lib/declarative_mapper.rb', line 4

def client_name
  @client_name
end

#client_pathObject (readonly)

Returns the value of attribute client_path.



4
5
6
# File 'lib/declarative_mapper.rb', line 4

def client_path
  @client_path
end

#project_pathObject (readonly)

Returns the value of attribute project_path.



4
5
6
# File 'lib/declarative_mapper.rb', line 4

def project_path
  @project_path
end

Instance Method Details

#convert(csv_row, yml_file_name) ⇒ Object



15
16
17
18
19
# File 'lib/declarative_mapper.rb', line 15

def convert(csv_row, yml_file_name)
  parser = CSVParser.new(yml_path(yml_file_name), client_name)

  parser.parse(csv_row)
end