class Occi::Core::Links

Public Class Methods

new(links=[]) click to toggle source
Calls superclass method Occi::Core::Entities.new
# File lib/occi/core/links.rb, line 12
def initialize(links=[])
  links.collect! {|link| convert link} if links
  super links
end

Public Instance Methods

<<(link) click to toggle source
Calls superclass method Occi::Core::Entities#<<
# File lib/occi/core/links.rb, line 17
def <<(link)
  super convert link
end
collect!() { |o| ... } click to toggle source
# File lib/occi/core/links.rb, line 5
def collect!
  block_given? or return enum_for(__method__)
  set = self.class.new
  each { |o| set << yield(o) }
  replace(set)
end
create(*args) click to toggle source
# File lib/occi/core/links.rb, line 21
def create(*args)
  link       = Occi::Core::Link.new(*args)
  link.model = @model if @model
  self << link

  link
end

Private Instance Methods

convert(link) click to toggle source
# File lib/occi/core/links.rb, line 31
def convert(link)
  if link.kind_of? String
    link_location = link
    link = Occi::Core::Link.new
    link.id = link_location.split('/').last
    link.location = link_location
  end

  link
end