obf 0.9.4 → 0.9.5

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 (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/obf/external.rb +26 -0
  3. data/lib/obf/pdf.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5fbd874eea89c4f3ffb839156401a8301d306dd732964294bd838dc79af2cf61
4
- data.tar.gz: 64bd6ba460a69d47ade29f2aa17b66634ee07644f8abff7b5195662d9349edbe
3
+ metadata.gz: 88ee044dff3f0e9119c892b13270faeffd5f65bc942b1c5caf00eca770420c47
4
+ data.tar.gz: a0316557377848c9f84fe4762796d68bf3382e901629125c0063a4733673e2bb
5
5
  SHA512:
6
- metadata.gz: 609194866a8fa10b06ebba2dc7799e0deb80935ef32dc57afc37b5ec57a0dcde9d4ea78b87a9f3c9a277e0235c245e259ffc0b9ff41505bca9e61718f172f3a0
7
- data.tar.gz: 65f4d61eec203c20ba57d751bc7721e81a163bc276ce6b1798ee361741713af9ef677b510081ad9129529c24a8ab8ac1c2f1e37d209b1d659b97971a756ba762
6
+ metadata.gz: b5ce21f914571fe536550fba8d589f6c8a460f0ae28bf013e98a9e6a26ab9f0ae88a6dbc29a0078edfad4927777616c61318201cdda243f4412c383fb6d34964
7
+ data.tar.gz: 84154874977a12f7bab9e994493d8ab9381d3d309b4a94dc36738cb0a866be41b01fff5a2f1b8599dc8e6bb171fcef6da6b861c879a34d83ab81885697bd822c
data/lib/obf/external.rb CHANGED
@@ -16,6 +16,11 @@ module OBF::External
16
16
  res['default_layout'] = hash['default_layout'] || 'landscape'
17
17
  res['url'] = hash['url']
18
18
  res['data_url'] = hash['data_url']
19
+
20
+ res['default_locale'] = hash['default_locale'] if hash['default_locale']
21
+ res['label_locale'] = hash['label_locale'] if hash['label_locale']
22
+ res['vocalization_locale'] = hash['vocalization_locale'] if hash['vocalization_locale']
23
+
19
24
  res['description_html'] = hash['description_html']
20
25
  res['protected_content_user_identifier'] = hash['protected_content_user_identifier'] if hash['protected_content_user_identifier']
21
26
  res['license'] = OBF::Utils.parse_license(hash['license'])
@@ -57,6 +62,27 @@ module OBF::External
57
62
  button['load_board']['path'] = "board_#{original_button['load_board']['id']}.obf"
58
63
  end
59
64
  end
65
+ if original_button['translations']
66
+ original_button['translations'].each do |loc, hash|
67
+ next unless hash.is_a?(Hash)
68
+ button['translations'] ||= {}
69
+ button['translations'][loc] ||= {}
70
+ button['translations'][loc]['label'] = hash['label'].to_s if hash['label']
71
+ button['translations'][loc]['vocalization'] = hash['vocalization'].to_s if hash['vocalization']
72
+ (hash['inflections'] || {}).each do |key, val|
73
+ if key.match(/^ext_/)
74
+ button['translations'][loc]['inflections'] ||= {}
75
+ button['translations'][loc]['inflections'][key] = val
76
+ else
77
+ button['translations'][loc]['inflections'] ||= {}
78
+ button['translations'][loc]['inflections'][key] = val.to_s
79
+ end
80
+ end
81
+ hash.keys.each do |key|
82
+ button['translations'][loc][key] = hash[key] if key.match(/^ext_/)
83
+ end
84
+ end
85
+ end
60
86
  if original_button['hidden']
61
87
  button['hidden'] = original_button['hidden']
62
88
  end
data/lib/obf/pdf.rb CHANGED
@@ -212,7 +212,7 @@ module OBF::PDF
212
212
  end
213
213
  image_local_path = image && OBF::Utils.save_image(image, options['zipper'], bg)
214
214
  if image_local_path && File.exist?(image_local_path)
215
- pdf.image image_local_path, :fit => [button_width - 10, button_height - text_height - 5], :position => :center, :vposition => :center
215
+ pdf.image(image_local_path, :fit => [button_width - 10, button_height - text_height - 5], :position => :center, :vposition => :center) rescue nil
216
216
  File.unlink image_local_path
217
217
  end
218
218
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: obf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Whitmer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-08 00:00:00.000000000 Z
11
+ date: 2019-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json