Module: ActiveCMIS::Type::InstanceMethods

Defined in:
lib/active_cmis/type.rb

Overview

Instance Methods on CMIS Types

Instance Method Summary collapse

Instance Method Details

#initialize(attributes) ⇒ Object

Creates a new CMIS Object

Parameters:

  • attributes (Hash)

    Attributes for a newly created object of the current type

Returns:



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/active_cmis/type.rb', line 43

def initialize(rep = nil, data = nil, parameters = {})
  case rep
  when Hash
    attributes = rep
    rep = nil
    data = nil # Force data and parameters to be empty in that case (NOTE: assert may be better?)
    parameters = {}
  when NilClass
  else
    if rep != self.class.repository
      raise "Trying to create element in different repository than type"
    end
  end
  super(rep || self.class.repository, data, parameters)
  unless attributes.nil?
    update(attributes)
  end
end