module ROM::Cassandra::Commands

The collection of Cassandra-specific ROM commands

@api public

Public Class Methods

included(klass) click to toggle source

@private

# File lib/rom/cassandra/commands.rb, line 12
def self.included(klass)
  klass.__send__ :adapter, :cassandra
  klass.__send__ :option, :initial, default: true
end
new(*) click to toggle source

Restricts the relation by a corresponding request

Calls superclass method
# File lib/rom/cassandra/commands.rb, line 19
def initialize(*)
  super
  @relation = relation.public_send(restriction) if options.fetch(:initial)
end

Public Instance Methods

execute(command = self) click to toggle source

Implements the execute method of the ‘ROM::Command` abstract class

@param [ROM::Command] command The updated command

@return [Array]

The empty array (Cassandra doesn't select rows when writes data).
# File lib/rom/cassandra/commands.rb, line 31
def execute(command = self)
  command.to_a
end

Private Instance Methods

method_missing(name, *args) click to toggle source
# File lib/rom/cassandra/commands.rb, line 37
def method_missing(name, *args)
  updated_relation = relation.public_send(name, *args)
  self.class.new updated_relation, initial: nil
end
respond_to_missing?(name, *) click to toggle source
# File lib/rom/cassandra/commands.rb, line 42
def respond_to_missing?(name, *)
  relation.respond_to? name
end