Class: Mmapper::Instance

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

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ Instance

Returns a new instance of Instance.



30
31
32
33
# File 'lib/mmapper.rb', line 30

def initialize(filename)
  @mmapper_id = Mmapper.create_mmapper(filename)
  raise "Failed to load file: #{filename}" if @mmapper_id < 0
end

Instance Method Details

#find_matching_line(prefix) ⇒ Object



35
36
37
38
39
# File 'lib/mmapper.rb', line 35

def find_matching_line(prefix)
  result = Mmapper.find_matching_line(@mmapper_id, prefix)
  return nil if result.nil? || result.empty?
  result
end