Method: HmxClient::Client#loadType
- Defined in:
- lib/hmx/client.rb
#loadType ⇒ Object
Take all of the documents in a folder for a type (the opposite of dumpType above) and simply put them back in
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/hmx/client.rb', line 109 def loadType h = getapi typeName = @args.shift folderName = $folder + "/" + typeName Dir.foreach(folderName) { | f | puts "Working with #{ f }" fullFile = folderName + "/" + f if (File.file?(fullFile)) content = File.open(fullFile) { | h | c = ''; while(line = h.gets) c = c + line end c } puts "Content is #{ content } " h.putData(JSON.parse(content)) end } end |