module Ork::Embeddable
Public Class Methods
included(klass)
click to toggle source
# File lib/ork/model/embedded.rb, line 6 def self.included(klass) klass.send(:include, Ork::Model) klass.extend(Ork::Model::Embedded::ClassMethods) end
Public Instance Methods
==(other)
click to toggle source
Check for equality by doing the following assertions:
-
That the passed model is of the same type.
-
That they have the same attributes.
How it was developed, 2 implies 1.
# File lib/ork/model/embedded.rb, line 30 def ==(other) other.kind_of?(model) && __persist_attributes == other.__persist_attributes && other.attributes[model.__parent_key] == @attributes[model.__parent_key] end
Also aliased as: eql?
__parent()
click to toggle source
# File lib/ork/model/embedded.rb, line 15 def __parent @attributes[model.__parent_key] or raise Ork::ParentMissing end
__parent=(object)
click to toggle source
# File lib/ork/model/embedded.rb, line 19 def __parent=(object) @attributes[model.__parent_key] = object end
embeddable?()
click to toggle source
# File lib/ork/model/embedded.rb, line 11 def embeddable? true end
inspect()
click to toggle source
Pretty print for the model
Example: User.new(name: 'John').inspect # => #<User {:name=>"John"}>
# File lib/ork/model/embedded.rb, line 44 def inspect "#<#{model} #{attributes.inspect}>" end