Class: MassiveRecord::ORM::Schema::ColumnFamily
- Inherits:
-
Object
- Object
- MassiveRecord::ORM::Schema::ColumnFamily
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/massive_record/orm/schema/column_family.rb
Instance Attribute Summary collapse
-
#autoload_fields ⇒ Object
writeonly
Sets the attribute autoload_fields.
-
#column_families ⇒ Object
Returns the value of attribute column_families.
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options_for_autoload_created_fields ⇒ Object
readonly
Returns the value of attribute options_for_autoload_created_fields.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #attribute_name_taken?(name, check_only_self = false) ⇒ Boolean
- #autoload? ⇒ Boolean
- #autoload_fields? ⇒ Boolean
- #contained_in ⇒ Object
- #contained_in=(column_families) ⇒ Object
- #hash ⇒ Object
-
#initialize(*args) ⇒ ColumnFamily
constructor
A new instance of ColumnFamily.
Constructor Details
#initialize(*args) ⇒ ColumnFamily
Returns a new instance of ColumnFamily.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/massive_record/orm/schema/column_family.rb', line 21 def initialize(*args) = args. .symbolize_keys! @fields = Fields.new @fields.contained_in = self if .has_key? :autoload # TODO remove this for next version ActiveSupport::Deprecation.warn("autoload is deprecated as an intitializer option. Please use autoload_fields instead!") [:autoload_fields] = .delete :autoload end self.name = [:name] self.column_families = [:column_families] self.autoload_fields = [:autoload_fields] end |
Instance Attribute Details
#autoload_fields=(value) ⇒ Object
Sets the attribute autoload_fields
7 8 9 |
# File 'lib/massive_record/orm/schema/column_family.rb', line 7 def autoload_fields=(value) @autoload_fields = value end |
#column_families ⇒ Object
Returns the value of attribute column_families.
7 8 9 |
# File 'lib/massive_record/orm/schema/column_family.rb', line 7 def column_families @column_families end |
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
8 9 10 |
# File 'lib/massive_record/orm/schema/column_family.rb', line 8 def fields @fields end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/massive_record/orm/schema/column_family.rb', line 8 def name @name end |
#options_for_autoload_created_fields ⇒ Object (readonly)
Returns the value of attribute options_for_autoload_created_fields.
8 9 10 |
# File 'lib/massive_record/orm/schema/column_family.rb', line 8 def @options_for_autoload_created_fields end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
39 40 41 |
# File 'lib/massive_record/orm/schema/column_family.rb', line 39 def ==(other) other.instance_of?(self.class) && other.hash == hash end |
#attribute_name_taken?(name, check_only_self = false) ⇒ Boolean
56 57 58 59 |
# File 'lib/massive_record/orm/schema/column_family.rb', line 56 def attribute_name_taken?(name, check_only_self = false) name = name.to_s check_only_self || contained_in.nil? ? fields.attribute_name_taken?(name, true) : contained_in.attribute_name_taken?(name) end |
#autoload? ⇒ Boolean
67 68 69 70 71 |
# File 'lib/massive_record/orm/schema/column_family.rb', line 67 def autoload? # TODO remove this method for next version ActiveSupport::Deprecation.warn("ColumnFamily#autoload? is deprecated. Please use autoload_fields? instead") autoload_fields? end |
#autoload_fields? ⇒ Boolean
63 64 65 |
# File 'lib/massive_record/orm/schema/column_family.rb', line 63 def autoload_fields? @autoload_fields == true end |
#contained_in ⇒ Object
52 53 54 |
# File 'lib/massive_record/orm/schema/column_family.rb', line 52 def contained_in column_families end |
#contained_in=(column_families) ⇒ Object
48 49 50 |
# File 'lib/massive_record/orm/schema/column_family.rb', line 48 def contained_in=(column_families) self.column_families = column_families end |
#hash ⇒ Object
44 45 46 |
# File 'lib/massive_record/orm/schema/column_family.rb', line 44 def hash name.hash end |