Class: DrbImages
- Inherits:
-
Object
- Object
- DrbImages
- Includes:
- DRbUndumped, Eprint
- Defined in:
- lib/DrbDB/DrbImages.rb
Overview
this file is part of manqod manqod is distributed under the CDDL licence the owner of manqod is Dobai-Pataky Balint([email protected])
Constant Summary
Constants included from Eprint
Instance Attribute Summary collapse
-
#drbdb ⇒ Object
readonly
Returns the value of attribute drbdb.
-
#images ⇒ Object
readonly
Returns the value of attribute images.
Instance Method Summary collapse
- #get_image(image_id) ⇒ Object
-
#initialize(drbdb) ⇒ DrbImages
constructor
A new instance of DrbImages.
- #keys ⇒ Object
- #load_all ⇒ Object
- #to_s ⇒ Object
Methods included from Eprint
#ecode, #edebug, #eerror, #eeval, #eexception, #efatal, #einfo, #eprint, #ewarn, #getBinding, #report_mail
Constructor Details
#initialize(drbdb) ⇒ DrbImages
Returns a new instance of DrbImages.
8 9 10 11 |
# File 'lib/DrbDB/DrbImages.rb', line 8 def initialize(drbdb) @drbdb=drbdb @images=Hash.new end |
Instance Attribute Details
#drbdb ⇒ Object (readonly)
Returns the value of attribute drbdb.
12 13 14 |
# File 'lib/DrbDB/DrbImages.rb', line 12 def drbdb @drbdb end |
#images ⇒ Object (readonly)
Returns the value of attribute images.
12 13 14 |
# File 'lib/DrbDB/DrbImages.rb', line 12 def images @images end |
Instance Method Details
#get_image(image_id) ⇒ Object
29 30 31 |
# File 'lib/DrbDB/DrbImages.rb', line 29 def get_image(image_id) @images[image_id.to_i] end |
#keys ⇒ Object
32 33 34 |
# File 'lib/DrbDB/DrbImages.rb', line 32 def keys @images.keys end |
#load_all ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/DrbDB/DrbImages.rb', line 15 def load_all @keys=Hash.new begin drbdb.admin.rows("select * from images").each{|row| @images[row["id"].to_i]=row @drbdb.cache.set("im[#{row["id"]}]",row) @keys[row["id"].to_i]="im[#{row["id"]}]" } rescue => err end @drbdb.cache.set("imkeys",@keys) einfo("#{@images.size} images") self end |
#to_s ⇒ Object
35 36 37 |
# File 'lib/DrbDB/DrbImages.rb', line 35 def to_s "Images of #{drbdb}" end |