Class: Namey::Parser

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

Overview

parse the census bureau data files and load into our datasource

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dbname = Namey.db_path) ⇒ Parser

initialize the parser dbname - Sequel style db URI ex: ‘sqlite://foo.db’



17
18
19
# File 'lib/namey/parser.rb', line 17

def initialize(dbname = Namey.db_path)     
  @db = Sequel.connect(dbname)
end

Instance Attribute Details

#dbObject

Returns the value of attribute db.



11
12
13
# File 'lib/namey/parser.rb', line 11

def db
  @db
end

Instance Method Details

#load_female_names(src) ⇒ Object

load in the female name list



31
32
33
# File 'lib/namey/parser.rb', line 31

def load_female_names(src)
  parse_file(src, "female")
end

#load_male_names(src) ⇒ Object

load in the male name list



24
25
26
# File 'lib/namey/parser.rb', line 24

def load_male_names(src)
  parse_file(src, "male")
end

#load_surnames(src) ⇒ Object

load in the surname list



38
39
40
# File 'lib/namey/parser.rb', line 38

def load_surnames(src)
  parse_file(src, "surname")
end