Method: Rediska::SortedSetArgumentHandler#initialize
- Defined in:
- lib/rediska/sorted_set_argument_handler.rb
#initialize(args) ⇒ SortedSetArgumentHandler
Returns a new instance of SortedSetArgumentHandler.
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/rediska/sorted_set_argument_handler.rb', line 6 def initialize(args) @number_of_keys = args.shift @keys = args.shift(number_of_keys) args.inject(self) {|handler, item| handler.handle(item) } # Defaults. @weights ||= Array.new(number_of_keys) { 1 } @aggregate ||= :sum # Validation. raise Redis::CommandError, 'ERR syntax error' unless weights.size == number_of_keys raise Redis::CommandError, 'ERR syntax error' unless [:min, :max, :sum].include?(aggregate) end |