Module: Zendesk::Strategy::Simple

Extended by:
Simple
Included in:
Simple
Defined in:
lib/zendesk/strategy/simple.rb

Instance Method Summary collapse

Instance Method Details

#exec(db, command_ast, results = FrozenHash.new) ⇒ Object


23
24
25
# File 'lib/zendesk/strategy/simple.rb', line 23

def exec(db, command_ast, results = FrozenHash.new)
  results = do_exec db, command_ast, results
end

#load(file_paths) ⇒ Object


12
13
14
15
16
17
18
19
20
21
# File 'lib/zendesk/strategy/simple.rb', line 12

def load(file_paths)
  file_paths.inject(FrozenHash.new) do |db, file_path|
    table_name = File.basename(file_path, '.json')
    table_data = JSON.load File.read file_path

    table_data.inject(db) do |db, row|
      db.add(table_name, row)
    end
  end
end