Class: RedisMemo::MemoizeQuery::CachedSelect::BindParams::Plan::DependencySizeEstimation
- Inherits:
-
Object
- Object
- RedisMemo::MemoizeQuery::CachedSelect::BindParams::Plan::DependencySizeEstimation
- Defined in:
- lib/redis_memo/memoize_query/cached_select/bind_params.rb
Instance Method Summary collapse
- #*(other) ⇒ Object
- #+(other) ⇒ Object
- #[](key) ⇒ Object
- #[]=(key, val) ⇒ Object
-
#initialize(hash = nil) ⇒ DependencySizeEstimation
constructor
A new instance of DependencySizeEstimation.
- #to_i ⇒ Object
Constructor Details
#initialize(hash = nil) ⇒ DependencySizeEstimation
Returns a new instance of DependencySizeEstimation.
189 190 191 |
# File 'lib/redis_memo/memoize_query/cached_select/bind_params.rb', line 189 def initialize(hash = nil) @hash = hash end |
Instance Method Details
#*(other) ⇒ Object
201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/redis_memo/memoize_query/cached_select/bind_params.rb', line 201 def *(other) merged_hash = hash.dup other.hash.each do |k, v| if merged_hash.include?(k) merged_hash[k] *= v else merged_hash[k] = v end end self.class.new(merged_hash) end |
#+(other) ⇒ Object
193 194 195 196 197 198 199 |
# File 'lib/redis_memo/memoize_query/cached_select/bind_params.rb', line 193 def +(other) merged_hash = hash.dup other.hash.each do |k, v| merged_hash[k] += v end self.class.new(merged_hash) end |
#[](key) ⇒ Object
213 214 215 |
# File 'lib/redis_memo/memoize_query/cached_select/bind_params.rb', line 213 def [](key) hash[key] end |
#[]=(key, val) ⇒ Object
217 218 219 |
# File 'lib/redis_memo/memoize_query/cached_select/bind_params.rb', line 217 def []=(key, val) hash[key] = val end |
#to_i ⇒ Object
221 222 223 224 225 226 227 |
# File 'lib/redis_memo/memoize_query/cached_select/bind_params.rb', line 221 def to_i ret = 0 hash.each do |_, v| ret += v end ret end |