Method: WAB::Impl::Model#initialize

Defined in:
lib/wab/impl/model.rb

#initialize(dir, indent = 0) ⇒ Model

Create a new Model using the designated directory as the store.

dir

directory to store data in



20
21
22
23
24
25
26
27
28
# File 'lib/wab/impl/model.rb', line 20

def initialize(dir, indent=0)
  @dir = dir.nil? ? nil : File.expand_path(dir)
  @cnt = 0
  @indent = indent
  @map = {}
  @lock = Thread::Mutex.new
  FileUtils.mkdir_p(@dir) unless @dir.nil? || Dir.exist?(@dir)
  load_files unless @dir.nil?
end