Class: Fias::Import::Dbf
- Inherits:
-
Object
- Object
- Fias::Import::Dbf
- Defined in:
- lib/fias/import/dbf.rb
Instance Attribute Summary collapse
-
#files ⇒ Object
readonly
Returns the value of attribute files.
Instance Method Summary collapse
-
#initialize(path, encoding = DEFAULT_ENCODING) ⇒ Dbf
constructor
A new instance of Dbf.
- #only(*names) ⇒ Object
Constructor Details
#initialize(path, encoding = DEFAULT_ENCODING) ⇒ Dbf
Returns a new instance of Dbf.
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/fias/import/dbf.rb', line 4 def initialize(path, encoding = DEFAULT_ENCODING) @path = path @files = {} unless Dir.exist?(@path) fail ArgumentError, "FIAS database path #{@path} does not exists" end open_files(encoding) end |
Instance Attribute Details
#files ⇒ Object (readonly)
Returns the value of attribute files.
29 30 31 |
# File 'lib/fias/import/dbf.rb', line 29 def files @files end |
Instance Method Details
#only(*names) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/fias/import/dbf.rb', line 15 def only(*names) return @files if names.empty? names = names.map do |name| name = name.to_sym name == :houses ? HOUSE_TABLES.keys : name name == :nordocs ? NORDOC_TABLES.keys : name end names.flatten! @files.slice(*names) end |