module Fog::Attributes::ClassMethods
Public Instance Methods
Source
# File lib/fog/core/attributes.rb, line 4 def _load(marshalled) new(Marshal.load(marshalled)) end
Source
# File lib/fog/core/attributes.rb, line 12 def associations @associations ||= {} end
Source
# File lib/fog/core/attributes.rb, line 36 def attribute(name, options = {}) type = options.fetch(:type, "default").to_s.capitalize Fog::Attributes.const_get(type).new(self, name, options) end
Defines a new attribute @param [Symbol] name attribute name @param [Hash] options (see {Default#initialize}) @option options [Symbol, ::String] :type attribute type (see {Attributes}) @option options [Symbol] :squash @option options [::Array] :aliases @option options [Object] :default @option options [Object] :as
Source
# File lib/fog/core/attributes.rb, line 16 def attributes @attributes ||= [] end
Source
# File lib/fog/core/attributes.rb, line 20 def default_values @default_values ||= {} end
Source
# File lib/fog/core/attributes.rb, line 45 def has_many(name, collection_name, options = {}) Fog::Associations::ManyModels.new(self, name, collection_name, options) end
Source
# File lib/fog/core/attributes.rb, line 53 def has_many_identities(name, collection_name, options = {}) Fog::Associations::ManyIdentities.new(self, name, collection_name, options) end
Source
# File lib/fog/core/attributes.rb, line 41 def has_one(name, collection_name, options = {}) Fog::Associations::OneModel.new(self, name, collection_name, options) end
Source
# File lib/fog/core/attributes.rb, line 49 def has_one_identity(name, collection_name, options = {}) Fog::Associations::OneIdentity.new(self, name, collection_name, options) end
Source
# File lib/fog/core/attributes.rb, line 57 def identity(name, options = {}) @identity = name attribute(name, options) end
Source
# File lib/fog/core/attributes.rb, line 62 def ignore_attributes(*args) @ignored_attributes = args.map(&:to_s) end
Source
# File lib/fog/core/attributes.rb, line 66 def ignored_attributes @ignored_attributes ||= [] end