Skip to content

Commit

Permalink
feat: переместит значение инкремента в начало массива данных
Browse files Browse the repository at this point in the history
  • Loading branch information
folklore committed Jul 20, 2016
1 parent 0d1b128 commit e6be297
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
source 'https://rubygems.org'

gemspec
gem 'json', '< 2' if RUBY_VERSION < '2'
gem 'activesupport', '< 5' if RUBY_VERSION < '2'

gemspec
8 changes: 4 additions & 4 deletions lib/redis_counters/hash_counter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ def group_keys
# Returns Array of WithIndifferentAccess.
#
def partition_data(cluster, partition)
keys = group_keys.dup << :value
keys = group_keys.dup.unshift(:value)
redis.hgetall(key(partition, cluster)).inject(Array.new) do |result, (key, value)|
values = key.split(value_delimiter, -1) << format_value(value)
values = values.from(1) unless group_keys.present?
values = key.split(value_delimiter, -1).unshift(format_value(value))
values.delete_at(1) unless group_keys.present?
result << Hash[keys.zip(values)].with_indifferent_access
end
end
Expand All @@ -67,4 +67,4 @@ def float_mode?
end
end

end
end

0 comments on commit e6be297

Please sign in to comment.