dictation 1.0.0 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dictation/serializer.rb +9 -1
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ea842ecf7f99848898ad32ac6accae61d57e59ba
4
- data.tar.gz: 75f245d58bdfe3b456d8cda2d09327e9668a5c45
3
+ metadata.gz: f30ad73e17b72aa741016ab25b236bd28cc44a59
4
+ data.tar.gz: d5321bc86848ddce6b51c3a6cf068d98a1663405
5
5
  SHA512:
6
- metadata.gz: 664b01f3d7b97636e2c985428b3641dc184bfea53552b37a89730da128a4d170699482c05317010834e7e835114848835883b36581a680fa2691c995e7d7383a
7
- data.tar.gz: 36072fec46ad89922e5c797fd8d95a86ccbb938709cbf32787c7ab029f0234741e35a9dd0b2993af98c44bd39970e09aa3f2b3106277959c7d103eb21e32e659
6
+ metadata.gz: afbba9306282cd7ac299eec403179ad75c81c74cde5b5cb0aafc6b1a466e452d8ad5cbfc93e0d7791dcde6134faa30be0259aa4776cfcb22dd179b1c91420008
7
+ data.tar.gz: 4234d2deb105c0530767224c61856ad7ace0f090c4bd5f9ebc023388b7bf32e632fd9bced65f1c6b0c6588805e99aff644eebdb85157772a901f30822c727785
@@ -13,7 +13,15 @@ module Dictation
13
13
  def deserialize(file)
14
14
  words = []
15
15
  File.open(file).each do |line|
16
- words.push(JSON.parse(line))
16
+ obj = JSON.parse(line)
17
+ if obj.is_a?(Hash)
18
+ class_name = obj['json_class'].split('::').inject(Kernel) { |namespace, const_name| namespace.const_get(const_name) }
19
+ args = obj['data']
20
+ word = class_name.new(*args)
21
+ else
22
+ word = obj
23
+ end
24
+ words.push(word)
17
25
  end
18
26
  words
19
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dictation
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jing Li
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-27 00:00:00.000000000 Z
11
+ date: 2013-12-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Practice foreign language by listening and writing (only for Mac OS X).
14
14
  email: