lib/boom/storage/json.rb in boom-0.1.2 vs lib/boom/storage/json.rb in boom-0.2.0
- old
+ new
@@ -30,11 +30,11 @@
# Take a Json representation of data and explode it out into the consituent
# Lists and Items for the given Storage instance.
#
# Returns nothing.
def populate
- storage = Yajl::Parser.new.parse(File.new(json_file, 'r'))
+ storage = JSON.parse(File.new(json_file, 'r').read)
storage['lists'].each do |lists|
lists.each do |list_name, items|
@lists << list = List.new(list_name)
@@ -59,10 +59,10 @@
# Public: the Json representation of the current List and Item assortment
# attached to the Storage instance.
#
# Returns a String Json representation of its Lists and their Items.
def to_json
- Yajl::Encoder.encode(to_hash, :pretty => true)
+ JSON.generate(to_hash)
end
end
end
end