familia 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,13 @@
1
1
  FAMILIA, CHANGES
2
2
 
3
+
4
+ #### 0.6.3 (2010-12-30) ###############################
5
+
6
+ * FIXED: HashKey#update
7
+ * FIXED: count in List#members, SortedSed#members
8
+ * ADDED: List#add
9
+
10
+
3
11
  #### 0.6.2 (2010-12-29) ###############################
4
12
 
5
13
  * FIXED: Familia::ClassMethods.ttl=
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :MAJOR: 0
3
3
  :MINOR: 6
4
- :PATCH: 2
4
+ :PATCH: 3
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{familia}
8
- s.version = "0.6.2"
8
+ s.version = "0.6.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Delano Mandelbaum"]
@@ -263,7 +263,7 @@ module Familia
263
263
  return false if idx.to_s.empty?
264
264
  objkey = rediskey idx, suffix
265
265
  ret = Familia.redis(self.uri).exists objkey
266
- Familia.trace :EXISTS, Familia.redis(self.uri), "#{rediskey(obj.index, suffix)} #{ret}", caller.first
266
+ Familia.trace :EXISTS, Familia.redis(self.uri), "#{rediskey(idx, suffix)} #{ret}", caller.first
267
267
  ret
268
268
  end
269
269
  def destroy! idx, suffix=:object
@@ -86,7 +86,7 @@ module Familia
86
86
  def initialize name, opts={}
87
87
  @name, @opts = name, opts
88
88
  @name = @name.join(Familia.delim) if Array === @name
89
- Familia.ld [name, opts, caller[0]].inspect
89
+ #Familia.ld [name, opts, caller[0]].inspect
90
90
  self.extend @opts[:extend] if Module === @opts[:extend]
91
91
  @db = @opts.delete(:db)
92
92
  @ttl = @opts.delete(:ttl)
@@ -139,7 +139,7 @@ module Familia
139
139
  def update_expiration(ttl=nil)
140
140
  ttl ||= @opts[:ttl] || self.class.ttl
141
141
  return unless ttl && ttl.to_i > 0
142
- Familia.info "#{rediskey} to #{ttl}"
142
+ Familia.ld "#{rediskey} to #{ttl}"
143
143
  expire ttl.to_i
144
144
  end
145
145
 
@@ -259,6 +259,7 @@ module Familia
259
259
  def << v
260
260
  push v
261
261
  end
262
+ alias_method :add, :<<
262
263
 
263
264
  def unshift *values
264
265
  values.flatten.compact.each { |v| redis.lpush rediskey, to_redis(v) }
@@ -304,6 +305,7 @@ module Familia
304
305
  end
305
306
 
306
307
  def members count=-1
308
+ count -= 1 if count > 0
307
309
  range 0, count
308
310
  end
309
311
  alias_method :all, :members
@@ -507,12 +509,14 @@ module Familia
507
509
  end
508
510
 
509
511
  def members count=-1, opts={}
512
+ count -= 1 if count > 0
510
513
  range 0, count, opts
511
514
  end
512
515
  alias_method :to_a, :members
513
516
  alias_method :all, :members
514
517
 
515
518
  def revmembers count=-1, opts={}
519
+ count -= 1 if count > 0
516
520
  revrange 0, count, opts
517
521
  end
518
522
 
@@ -674,7 +678,8 @@ module Familia
674
678
 
675
679
  def update h={}
676
680
  raise ArgumentError, "Argument to bulk_set must be a hash" unless Hash === h
677
- redis.hmset(rediskey, h.inject([]){ |ret,pair| ret + [pair[0], to_redis(pair[1])] })
681
+ data = h.inject([]){ |ret,pair| ret << [pair[0], to_redis(pair[1])] }.flatten
682
+ redis.hmset(rediskey, *data)
678
683
  end
679
684
  alias_method :merge!, :update
680
685
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: familia
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 2
10
- version: 0.6.2
9
+ - 3
10
+ version: 0.6.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Delano Mandelbaum