module ActiveOrient::BaseProperties

Public Instance Methods

default_attributes() click to toggle source

Default attributes support

# File lib/base_properties.rb, line 68
def default_attributes
                    {}
  #{:created_at => DateTime.now }
end
embedded() click to toggle source

return a string ready to include as embedded document used by Model.to_or

# File lib/base_properties.rb, line 36
def embedded
        { "@type" => 'd', "@class" => self.class.ref_name }
                    .merge(content_attributes)
                    .map{|y,x| z='';  z  <<  y.to_s << ': ' << x.to_or.to_s }.join(' ,')
        
end
to_human() click to toggle source

Default presentation of ActiveOrient::Model-Objects

# File lib/base_properties.rb, line 11
def to_human
        "<#{self.class.to_s.demodulize}: " + content_attributes.map do |attr, value|
                v= case value
                         when ActiveOrient::Model
                                 "< #{self.class.to_.demodulize} : #{value.rrid} >"
                         when OrientSupport::Array
                                 value.rrid #.to_human #.map(&:to_human).join("::")
                         else
                                 value.from_orient
                         end
                "%s : %s" % [ attr, v]  unless v.nil?
        end.compact.sort.join(', ') + ">".gsub('"' , ' ')
end