Sha256: abbadc20be8cc08e787b26e0fd6cc9595c147412aaf92f45fadeaf817a56324a

Contents?: true

Size: 1.25 KB

Versions: 3

Compression:

Stored size: 1.25 KB

Contents

require 'cassandra/0.8'
require 'set'

require 'cassandra_object/log_subscriber'
require 'cassandra_object/types'

module CassandraObject
  class Base
    class << self
      def column_family=(column_family)
        @column_family = column_family
      end

      def column_family
        @column_family || name.pluralize
      end

      def base_class
        klass = self
        while klass.superclass != Base
          klass = klass.superclass
        end
        klass
      end
    end

    extend ActiveModel::Naming
    extend ActiveSupport::DescendantsTracker
    
    include Connection
    include Callbacks
    include Identity
    include Attributes
    include Persistence
    include Indexes
    include Dirty
    include Validation
    include Associations
    include Batches
    include FinderMethods
    include Timestamps

    attr_reader :attributes
    attr_accessor :key

    include Serialization
    include Migrations
    include Mocking

    def initialize(attributes={})
      @key = attributes.delete(:key)
      @new_record = true
      @destroyed = false
      @attributes = {}.with_indifferent_access
      self.attributes = attributes
      @schema_version = self.class.current_schema_version
    end

    def to_model
      self
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gotime-cassandra_object-2.1.2 lib/cassandra_object/base.rb
gotime-cassandra_object-2.1.1 lib/cassandra_object/base.rb
gotime-cassandra_object-2.1.0 lib/cassandra_object/base.rb