Class: CassandraCQL::Schema
- Inherits:
-
Object
- Object
- CassandraCQL::Schema
- Defined in:
- lib/cassandra-cql/schema.rb
Instance Attribute Summary collapse
-
#column_families ⇒ Object
readonly
Returns the value of attribute column_families.
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
Instance Method Summary collapse
- #column_family_names ⇒ Object (also: #tables)
-
#initialize(schema) ⇒ Schema
constructor
A new instance of Schema.
- #keyspace ⇒ Object
- #method_missing(method, *args, &block) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(schema) ⇒ Schema
Returns a new instance of Schema.
21 22 23 24 25 26 27 |
# File 'lib/cassandra-cql/schema.rb', line 21 def initialize(schema) @schema = schema @column_families = {} @schema.cf_defs.each { |cf| @column_families[cf.name] = ColumnFamily.new(cf) } end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/cassandra-cql/schema.rb', line 29 def method_missing(method, *args, &block) if @schema.respond_to?(method) @schema.send(method) else super(method, *args, &block) end end |
Instance Attribute Details
#column_families ⇒ Object (readonly)
Returns the value of attribute column_families.
19 20 21 |
# File 'lib/cassandra-cql/schema.rb', line 19 def column_families @column_families end |
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
19 20 21 |
# File 'lib/cassandra-cql/schema.rb', line 19 def schema @schema end |
Instance Method Details
#column_family_names ⇒ Object Also known as: tables
45 46 47 |
# File 'lib/cassandra-cql/schema.rb', line 45 def column_family_names @column_families.keys end |
#keyspace ⇒ Object
41 42 43 |
# File 'lib/cassandra-cql/schema.rb', line 41 def keyspace name end |
#to_s ⇒ Object
37 38 39 |
# File 'lib/cassandra-cql/schema.rb', line 37 def to_s keyspace end |