Class: DrbImages

Inherits:
Object
  • Object
show all
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

Eprint::TERM_COLOUR

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#drbdbObject (readonly)

Returns the value of attribute drbdb.



12
13
14
# File 'lib/DrbDB/DrbImages.rb', line 12

def drbdb
  @drbdb
end

#imagesObject (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

#keysObject



32
33
34
# File 'lib/DrbDB/DrbImages.rb', line 32

def keys
	@images.keys
end

#load_allObject



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_sObject



35
36
37
# File 'lib/DrbDB/DrbImages.rb', line 35

def to_s
	"Images of #{drbdb}"
end