Method: DTAS::Mlib#initialize

Defined in:
lib/dtas/mlib.rb

#initialize(db) ⇒ Mlib

Returns a new instance of Mlib.



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/dtas/mlib.rb', line 39

def initialize(db)
  if String === db
    require 'sequel'
    opts = { single_threaded: true }
    db = "sqlite://#{db}" unless db.include?('://')
    opts[:transaction_mode] = :immediate
    opts[:synchronous] = :off
    opts[:case_sensitive_like] = false # only for 'search'
    db = Sequel.connect(db, opts)
  end
  @db = db
  @pwd = nil
  @follow_outside_symlinks = true
  @follow_inside_symlinks = true
  @root_node = nil
  @tags = TAGS.dup
  @tag_map = nil
  @suffixes = nil
  @work = nil
  @sources = [ # order matters
    (sox = DTAS::Source::Sox.new),
    DTAS::Source::Av.new,
    DTAS::Source::Ff.new,
    DTAS::Source::SplitFX.new(sox),
  ]
end