class UIC::Property::ObjectReference

Attributes

object[R]
type[R]

Public Class Methods

new(asset,property,slide,object=nil,type=nil) click to toggle source
# File lib/ruic/attributes.rb, line 102
def initialize(asset,property,slide,object=nil,type=nil)
        @asset    = asset
        @name     = property.name
        @slide    = slide
        @object   = object
        @type     = type
end

Public Instance Methods

object=(new_object) click to toggle source
# File lib/ruic/attributes.rb, line 109
def object=(new_object)
        raise "ObjectRef must be set to an asset (not a #{new_object.class.name})" unless new_object.is_a?(UIC::MetaData::AssetBase)
        @object = new_object
        write_value!
end
type=(new_type) click to toggle source
# File lib/ruic/attributes.rb, line 114
def type=(new_type)
        raise "ObjectRef types must be either :absolute or :path (not #{new_type.inspect})" unless [:absolute,:path].include?(new_type)
        @type = new_type
        write_value!
end

Private Instance Methods

write_value!() click to toggle source
# File lib/ruic/attributes.rb, line 120
def write_value!
        path = case @object
                when NilClass then ""
                else case @type
                        when :absolute then "##{@object.el['id']}"
                        when :path     then @asset.presentation.path_to( @object, @asset ).sub(/^[^:.]+:/,'')
                        # when :root     then @asset.presentation.path_to( @object ).sub(/^[^:.]+:/,'')
                end
        end
        @asset.presentation.set_attribute( @asset, @name, @slide, path )
end