class Occi::Core::Entities

Attributes

model[RW]

Public Class Methods

new(entities=[]) click to toggle source
Calls superclass method
# File lib/occi/core/entities.rb, line 10
def initialize(entities=[])
  entities.to_a.each { |entity| entity.model = @model } if @model
  super entities
end

Public Instance Methods

<<(entity) click to toggle source
Calls superclass method
# File lib/occi/core/entities.rb, line 35
def <<(entity)
  entity.model = @model if @model
  super entity
end
as_json(options={ }) click to toggle source

@param [Hash] options @return [Hashie::Mash] json representation

# File lib/occi/core/entities.rb, line 42
def as_json(options={ })
  self.to_a.as_json
end
check(set_defaults = false) click to toggle source
# File lib/occi/core/entities.rb, line 24
def check(set_defaults = false)
  each { |entity| entity.check(set_defaults) }
end
create(*args) click to toggle source
# File lib/occi/core/entities.rb, line 28
def create(*args)
  entity = Occi::Core::Entity.new(*args)
  entity.model = @model if @model
  self << entity
  entity
end
join(separator) click to toggle source
# File lib/occi/core/entities.rb, line 15
def join(separator)
  self.to_a.join(separator)
end
model=(model) click to toggle source
# File lib/occi/core/entities.rb, line 19
def model=(model)
  @model = model
  each { |entity| entity.model = model }
end