Class: WorldDb::ReaderBaseWithMoreAttribs
- Inherits:
-
Object
- Object
- WorldDb::ReaderBaseWithMoreAttribs
show all
- Includes:
- LogUtils::Logging, Models, TextUtils::ValueHelper
- Defined in:
- lib/worlddb/readers/base.rb
Class Method Summary
collapse
Instance Method Summary
collapse
#is_state?, #match_city, #match_country, #match_metro, #match_metro_flag, #match_metro_pop, #match_state_for_country, #match_supra, #match_supra_flag
Constructor Details
Returns a new instance of ReaderBaseWithMoreAttribs.
68
69
70
71
72
73
|
# File 'lib/worlddb/readers/base.rb', line 68
def initialize( text, more_attribs={} )
@text = text
@more_attribs = more_attribs
end
|
Class Method Details
.from_file(path, more_attribs = {}) ⇒ Object
52
53
54
55
56
57
|
# File 'lib/worlddb/readers/base.rb', line 52
def self.from_file( path, more_attribs={} )
text = File.read_utf8( path )
self.from_string( text, more_attribs )
end
|
.from_string(text, more_attribs = {}) ⇒ Object
59
60
61
62
|
# File 'lib/worlddb/readers/base.rb', line 59
def self.from_string( text, more_attribs={} )
puts "[debug] ReaderBase.from_string calling #{self.name}.new" self.new( text, more_attribs )
end
|
.from_zip(zip_file, entry_path, more_attribs = {}) ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/worlddb/readers/base.rb', line 23
def self.from_zip( zip_file, entry_path, more_attribs={} )
entry = zip_file.find_entry( entry_path )
text = entry.get_input_stream().read()
logger = LogUtils::Logger.root
logger.debug "text.encoding.name (before): #{text.encoding.name}"
text = text.force_encoding( Encoding::UTF_8 )
logger.debug "text.encoding.name (after): #{text.encoding.name}"
self.from_string( text, more_attribs )
end
|
Instance Method Details
65
|
# File 'lib/worlddb/readers/base.rb', line 65
def skip_tags?() @skip_tags == true; end
|
#strict? ⇒ Boolean
66
|
# File 'lib/worlddb/readers/base.rb', line 66
def strict?() @strict == true; end
|