notenote 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/note/cli.rb +14 -2
  3. data/lib/note/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f78d842dc42121cfc84e9610b0b7869b6c968f0dcaa4874dda75d618de9bfa81
4
- data.tar.gz: 7b2efa649831bb0ce998974cfab33879864486118fab60baaa4ea313f4bf0509
3
+ metadata.gz: 7e739b649898fe2b3cd03fef0dc45bd728ffbce50c3ee5cb6f7d1918bf59612f
4
+ data.tar.gz: e23ae24148d1ef7666fd26430f3f5413b228d4a9c8563ec039c6878ef542326d
5
5
  SHA512:
6
- metadata.gz: 4e3962ada9564374f722f51ce976e99934c7d3bdda17a165f0c7f856a4b88d3ea53d588d4c0a916b77c8f20250cd01e2c75b06644e1ba3d3cdbe4c40118c878d
7
- data.tar.gz: 7937389c96e845c4f96e70dcc005ae272be582fe0068c83deff63fb773a713a215c4b196853c1e4c5cc0e40e282b5f3b47749a4c65ca4be6a6e4de8d0da97fef
6
+ metadata.gz: a129c33ebc60c59500cac01472a99f71889579797adddc746c6b1177c9b4bbc60c1a38736b9c235d9b38df35d5091b43e84ec8da2ec98b556010b3e5b4f54924
7
+ data.tar.gz: aed23da98e1307fd318300a518b5c70381bb294f25b9488c850fa57ed65d235019f7793e7c7adfea97a3515ae8404fd0a694d7238c6cd0e5d76cbb1fae4305c8
data/lib/note/cli.rb CHANGED
@@ -99,9 +99,9 @@ module Note
99
99
  def create_config_file(notes_folder:)
100
100
  config_template = File.read(File.join(File.dirname(__FILE__), "config.json.template"))
101
101
 
102
- config = config_template % {
102
+ config = safe_tt(config_template, {
103
103
  notes_folder: notes_folder
104
- }
104
+ })
105
105
 
106
106
  config_file = File.join(Dir.home, ".notenote")
107
107
 
@@ -197,5 +197,17 @@ module Note
197
197
 
198
198
  puts "Pushed. ✅"
199
199
  end
200
+
201
+ # A custom string format method to avoid type
202
+ # errors when using str % hash.
203
+ def safe_tt(str, hash)
204
+ str_copy = str
205
+
206
+ hash.each do |key, value|
207
+ str_copy.gsub!("%{#{key}}", value.to_s)
208
+ end
209
+
210
+ str_copy
211
+ end
200
212
  end
201
213
  end
data/lib/note/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Note
2
- VERSION = "0.0.6".freeze
2
+ VERSION = "0.0.7".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notenote
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anatoli Makarevich