class Cassandra::Trigger
Represents a trigger on a cassandra table
Attributes
name[R]
@return [String] name of the trigger.
options[R]
@return [Hash] options of the trigger.
table[R]
@return [Cassandra::Table] table that the trigger applies to.
Public Class Methods
new(table, name, options)
click to toggle source
@private
# File lib/cassandra/trigger.rb 30 def initialize(table, 31 name, 32 options) 33 @table = table 34 @name = name.freeze 35 @options = options.freeze 36 end
Public Instance Methods
custom_class_name()
click to toggle source
@return [String] name of the trigger class
# File lib/cassandra/trigger.rb 39 def custom_class_name 40 @options['class'] 41 end
eql?(other)
click to toggle source
@private
# File lib/cassandra/trigger.rb 53 def eql?(other) 54 other.is_a?(Trigger) && 55 @table == other.table && 56 @name == other.name && 57 @options == other.options 58 end
Also aliased as: ==
inspect()
click to toggle source
@private
# File lib/cassandra/trigger.rb 62 def inspect 63 "#<#{self.class.name}:0x#{object_id.to_s(16)} " \ 64 "@name=#{@name.inspect} @table=#{@table.inspect} @options=#{@options.inspect}>" 65 end
to_cql()
click to toggle source
@return [String] a cql representation of this trigger
# File lib/cassandra/trigger.rb 44 def to_cql 45 keyspace_name = Util.escape_name(@table.keyspace.name) 46 table_name = Util.escape_name(@table.name) 47 trigger_name = Util.escape_name(@name) 48 49 "CREATE TRIGGER #{trigger_name} ON #{keyspace_name}.#{table_name} USING '#{@options['class']}';" 50 end