tsukasaoishi-miyazakiresistance 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -100,7 +100,13 @@ module MiyazakiResistance
100
100
  end
101
101
 
102
102
  def find_by_id(target)
103
- find_by_ids([target])
103
+ find_by_ids([target]).first
104
+ end
105
+
106
+ def find_and_update(first, args={})
107
+ list = self.find(first, args)
108
+ list = [list] unless list.is_a?(Array)
109
+ list.each {|inst| yield(inst) and inst.save}
104
110
  end
105
111
 
106
112
  def count(args = {})
@@ -110,7 +116,7 @@ module MiyazakiResistance
110
116
  else
111
117
  query = TokyoTyrant::RDBQRY.new(con)
112
118
  query = make_conditions(query, args[:conditions])
113
- kaeru_timeout{query.search}.size
119
+ kaeru_timeout{query.search.count}
114
120
  end
115
121
  rescue TimeoutError
116
122
  remove_pool(con)
@@ -13,7 +13,7 @@ require 'miyazaki_resistance/base'
13
13
  require 'miyazaki_resistance/error'
14
14
 
15
15
  module MiyazakiResistance
16
- VERSION = '0.0.10'
16
+ VERSION = '0.0.11'
17
17
  end
18
18
 
19
19
  MiyazakiResistance::Base.class_eval do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tsukasaoishi-miyazakiresistance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tsukasa OISHI