Class: Cassandra::Trigger
- Inherits:
-
Object
- Object
- Cassandra::Trigger
- Defined in:
- lib/cassandra/trigger.rb
Overview
Represents a trigger on a cassandra table
Instance Attribute Summary collapse
-
#name ⇒ String
readonly
Name of the trigger.
-
#options ⇒ Hash
readonly
Options of the trigger.
-
#table ⇒ Cassandra::Table
readonly
Table that the trigger applies to.
Instance Method Summary collapse
-
#custom_class_name ⇒ String
Name of the trigger class.
-
#to_cql ⇒ String
A cql representation of this trigger.
Instance Attribute Details
#name ⇒ String (readonly)
Returns name of the trigger.
25 26 27 |
# File 'lib/cassandra/trigger.rb', line 25 def name @name end |
#options ⇒ Hash (readonly)
Returns options of the trigger.
27 28 29 |
# File 'lib/cassandra/trigger.rb', line 27 def @options end |
#table ⇒ Cassandra::Table (readonly)
Returns table that the trigger applies to.
23 24 25 |
# File 'lib/cassandra/trigger.rb', line 23 def table @table end |
Instance Method Details
#custom_class_name ⇒ String
Returns name of the trigger class.
39 40 41 |
# File 'lib/cassandra/trigger.rb', line 39 def custom_class_name @options['class'] end |
#to_cql ⇒ String
Returns a cql representation of this trigger.
44 45 46 47 48 49 50 |
# File 'lib/cassandra/trigger.rb', line 44 def to_cql keyspace_name = Util.escape_name(@table.keyspace.name) table_name = Util.escape_name(@table.name) trigger_name = Util.escape_name(@name) "CREATE TRIGGER #{trigger_name} ON #{keyspace_name}.#{table_name} USING '#{@options['class']}';" end |