class MaxMind::DB::MemoryReader
@!visibility private
Attributes
size[R]
Public Class Methods
new(filename, options = {})
click to toggle source
# File lib/maxmind/db/memory_reader.rb, line 7 def initialize(filename, options = {}) if options[:is_buffer] @buf = filename @size = @buf.length return end @buf = File.read(filename, mode: 'rb').freeze @size = @buf.length end
Public Instance Methods
close()
click to toggle source
# File lib/maxmind/db/memory_reader.rb, line 25 def close; end
inspect()
click to toggle source
Override to not show @buf in inspect to avoid showing it in irb.
# File lib/maxmind/db/memory_reader.rb, line 21 def inspect "#<#{self.class.name}:0x#{self.class.object_id.to_s(16)}, @size=#{@size.inspect}>" end
read(offset, size)
click to toggle source
# File lib/maxmind/db/memory_reader.rb, line 27 def read(offset, size) @buf[offset, size] end