Module: MOOD

Defined in:
lib/meiou/mood.rb

Constant Summary collapse

@@MOOD =
PStore.new("db/moods.pstore")

Class Method Summary collapse

Class Method Details

.[](p) ⇒ Object



5
6
7
# File 'lib/meiou/mood.rb', line 5

def self.[] k
  @@MOOD.transaction { |db| db[k] }
end

.decr(k, *n) ⇒ Object



14
15
16
# File 'lib/meiou/mood.rb', line 14

def self.decr k, *n
  @@MOOD.transaction { |db| x = db[k].to_f; db[k] = x + n[0] || 1 }
end

.incr(k, n) ⇒ Object



11
12
13
# File 'lib/meiou/mood.rb', line 11

def self.incr k, n
  @@MOOD.transaction { |db| x = db[k].to_f; db[k] = x + n[0] || 1 }
end

.keysObject



8
9
10
# File 'lib/meiou/mood.rb', line 8

def self.keys
  @@MOOD.transaction { |db| db.keys }
end

.update(k, s) ⇒ Object



17
18
19
# File 'lib/meiou/mood.rb', line 17

def self.update k, s
  MOOD.incr(k, MOOD[s])
end