dynarex-blog 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/dynarex-blog.rb +16 -0
  2. metadata +1 -1
data/lib/dynarex-blog.rb CHANGED
@@ -68,6 +68,8 @@ class DynarexBlog
68
68
  uri = h[:title].gsub(/\s/,'-')
69
69
  lookup.update(lookup_id, uri: uri).save
70
70
  @hc_lookup.write(@current_lookup) { Document.new File.open(@file_path + @current_lookup,'r').read }
71
+
72
+ dynarex.record(id).tags.split(/\s/).each {|name| update_entry(name, id, h) }
71
73
  end
72
74
 
73
75
  def delete(id=0)
@@ -200,6 +202,20 @@ class DynarexBlog
200
202
  lookup = "%s%s_lookup.xml" % [@file_path, lookup_filename]
201
203
  File.open(lookup,'w'){|f| doc.write f}
202
204
  end
205
+
206
+ def update_entry(lookup_filename, id, h)
207
+
208
+ lookup_path = "%s%s_lookup.xml" % [@file_path, lookup_filename]
209
+
210
+ lookup = Dynarex.new lookup_path
211
+ lookup_id = lookup.records[id][:id]
212
+ file = lookup.records[id][:body][:file]
213
+
214
+ Dynarex.new(@file_path + file).update(id, h).save
215
+
216
+ uri = h[:title].gsub(/\s/,'-')
217
+ lookup.update(lookup_id, uri: uri).save
218
+ end
203
219
 
204
220
  def open_lookup_record(name, id)
205
221
  lookup_path = "%s%s_lookup.xml" % [@file_path, name]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynarex-blog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors: []
7
7