Class: QQWry::Record
- Inherits:
-
Object
- Object
- QQWry::Record
- Defined in:
- lib/qqwry/record.rb
Instance Attribute Summary collapse
-
#area ⇒ Object
readonly
Returns the value of attribute area.
-
#country ⇒ Object
readonly
Returns the value of attribute country.
-
#ip_end ⇒ Object
readonly
Returns the value of attribute ip_end.
-
#ip_start ⇒ Object
readonly
Returns the value of attribute ip_start.
Instance Method Summary collapse
-
#initialize(ip_start, file, offset) ⇒ Record
constructor
A new instance of Record.
- #ip_str_end ⇒ Object
- #ip_str_start ⇒ Object
Constructor Details
#initialize(ip_start, file, offset) ⇒ Record
Returns a new instance of Record.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/qqwry/record.rb', line 11 def initialize(ip_start, file, offset) @ip_start = ip_start file.seek(offset) @ip_end = BinData::Uint32le.read(file).to_i case BinData::Uint8.read(file).to_i when 0x1 offset = BinData::Uint24le.read(file).to_i file.seek(offset) case BinData::Uint8.read(file).to_i when 0x2 file.seek(BinData::Uint24le.read(file).to_i) @country = BinData::Stringz.read(file).to_s file.seek(offset + 4) else file.seek(-1, IO::SEEK_CUR) @country = BinData::Stringz.read(file).to_s end parse_area(file) when 0x2 offset = BinData::Uint24le.read(file).to_i parse_area(file) file.seek(offset) @country = BinData::Stringz.read(file).to_s else file.seek(-1, IO::SEEK_CUR) @country = BinData::Stringz.read(file).to_s parse_area(file) end if @country @country = conv(@country) @country = nil if @country=~ /\s*CZ88\.NET\s*/ end end |
Instance Attribute Details
#area ⇒ Object (readonly)
Returns the value of attribute area.
9 10 11 |
# File 'lib/qqwry/record.rb', line 9 def area @area end |
#country ⇒ Object (readonly)
Returns the value of attribute country.
9 10 11 |
# File 'lib/qqwry/record.rb', line 9 def country @country end |
#ip_end ⇒ Object (readonly)
Returns the value of attribute ip_end.
9 10 11 |
# File 'lib/qqwry/record.rb', line 9 def ip_end @ip_end end |
#ip_start ⇒ Object (readonly)
Returns the value of attribute ip_start.
9 10 11 |
# File 'lib/qqwry/record.rb', line 9 def ip_start @ip_start end |
Instance Method Details
#ip_str_end ⇒ Object
49 50 51 |
# File 'lib/qqwry/record.rb', line 49 def ip_str_end ip_str(@ip_end) end |
#ip_str_start ⇒ Object
45 46 47 |
# File 'lib/qqwry/record.rb', line 45 def ip_str_start ip_str(@ip_start) end |