Class: Zermelo::Filters::Steps::EmptyStep

Inherits:
BaseStep
  • Object
show all
Defined in:
lib/zermelo/filters/steps/empty_step.rb

Instance Attribute Summary

Attributes inherited from BaseStep

#attributes, #options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseStep

#initialize

Constructor Details

This class inherits a constructor from Zermelo::Filters::Steps::BaseStep

Class Method Details

.accepted_typesObject



8
9
10
# File 'lib/zermelo/filters/steps/empty_step.rb', line 8

def self.accepted_types
  [:set, :sorted_set, :list]
end

.returns_typeObject



12
13
14
# File 'lib/zermelo/filters/steps/empty_step.rb', line 12

def self.returns_type
  nil # same as the source type
end

Instance Method Details

#resolve(backend, associated_class, opts = {}) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/zermelo/filters/steps/empty_step.rb', line 16

def resolve(backend, associated_class, opts = {})
  case backend
  when Zermelo::Backends::Redis
    source    = opts[:source]
    temp_keys = opts[:temp_keys]
    shortcut  = opts[:shortcut]

    dest_set = associated_class.send(:temp_key, source.type)
    r_dest_set = backend.key_to_backend_key(dest_set)
    temp_keys << dest_set

    return dest_set if shortcut.nil?

    shortcut_params = case source.type
    when :sorted_set
      [r_dest_set, order] + opts[:shortcut_args]
    else
      [r_dest_set] + opts[:shortcut_args]
    end

    Zermelo::Filters::Redis::SHORTCUTS[source.type][shortcut].
      call(*shortcut_params)
  when Zermelo::Backends::InfluxDB
    # FIXME
  end
end