Class: UIC::Asset::Root

Inherits:
Object
  • Object
show all
Extended by:
Enumerable
Defined in:
lib/ruic/assets.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(presentation, element) ⇒ Root

Returns a new instance of Root.



31
32
33
34
# File 'lib/ruic/assets.rb', line 31

def initialize( presentation, element )
	@presentation = presentation
	@el = element
end

Class Attribute Details

.nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/ruic/assets.rb', line 6

def name
  @name
end

Instance Attribute Details

#elObject

Returns the value of attribute el.



30
31
32
# File 'lib/ruic/assets.rb', line 30

def el
  @el
end

#presentationObject

Returns the value of attribute presentation.



30
31
32
# File 'lib/ruic/assets.rb', line 30

def presentation
  @presentation
end

Class Method Details

.eachObject



11
12
13
# File 'lib/ruic/assets.rb', line 11

def each
	(@by_name.values - [self]).each{ |klass| yield klass }
end

.inspectObject



16
17
18
# File 'lib/ruic/assets.rb', line 16

def inspect
	"<#{@name}>"
end

.propertiesObject



7
8
9
# File 'lib/ruic/assets.rb', line 7

def properties
	(ancestors[1].respond_to?(:properties) ? ancestors[1].properties : {}).merge(@properties)
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



128
129
130
# File 'lib/ruic/assets.rb', line 128

def ==(other)
	(self.class==other.class) && (el==other.el)
end

#[](attribute_name, slide_name_or_index = nil) ⇒ Object

Get the value(s) of an attribute



98
99
100
101
102
103
104
105
106
# File 'lib/ruic/assets.rb', line 98

def [](attribute_name, slide_name_or_index=nil)
	if property = properties[attribute_name]
		if slide_name_or_index
			property.get( self, slide_name_or_index ) if has_slide?(slide_name_or_index)
		else
			UIC::ValuesPerSlide.new(@presentation,self,property)
		end
	end
end

#[]=(attribute_name, slide_name_or_index = nil, new_value) ⇒ Object

Set the value of an attribute, either across all slides, or on a particular slide el = 42 el = 42



111
112
113
114
115
# File 'lib/ruic/assets.rb', line 111

def []=( attribute_name, slide_name_or_index=nil, new_value )
	if property = properties[attribute_name] then
		property.set(self,new_value,slide_name_or_index)
	end
end

#at(sub_path) ⇒ Object Also known as: /



25
26
27
# File 'lib/ruic/assets.rb', line 25

def at(sub_path)
	presentation.at(sub_path,@el)
end

#childrenObject



45
46
47
# File 'lib/ruic/assets.rb', line 45

def children
	presentation.child_assets(@el)
end

#componentObject

Find the owning component (even if you are a component)



55
56
57
# File 'lib/ruic/assets.rb', line 55

def component
	presentation.owning_component(@el)
end

#component?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/ruic/assets.rb', line 59

def component?
	@el.name == 'Component'
end

#find(criteria = {}, &block) ⇒ Object



49
50
51
52
# File 'lib/ruic/assets.rb', line 49

def find(criteria={},&block)
	criteria[:under] ||= self
	presentation.find(criteria,&block)
end

#has_slide?(slide_name_or_index) ⇒ Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/ruic/assets.rb', line 71

def has_slide?(slide_name_or_index)
	presentation.has_slide?(@el,slide_name_or_index)
end

#inspectObject



120
121
122
# File 'lib/ruic/assets.rb', line 120

def inspect
	"<asset #{@el.name}##{@el['id']}>"
end

#master?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/ruic/assets.rb', line 63

def master?
	presentation.master?(@el)
end

#nameObject



89
90
91
# File 'lib/ruic/assets.rb', line 89

def name
	properties['name'].get( self, presentation.slide_index(@el) )
end

#name=(new_name) ⇒ Object



93
94
95
# File 'lib/ruic/assets.rb', line 93

def name=( new_name )
	properties['name'].set( self, new_name, presentation.slide_index(@el) )
end

#on_slide(slide_name_or_index) ⇒ Object



79
80
81
82
83
# File 'lib/ruic/assets.rb', line 79

def on_slide(slide_name_or_index)
	if has_slide?(slide_name_or_index)
		UIC::SlideValues.new( self, slide_name_or_index )
	end
end

#parentObject



41
42
43
# File 'lib/ruic/assets.rb', line 41

def parent
	presentation.parent_asset(@el)
end

#pathObject



85
86
87
# File 'lib/ruic/assets.rb', line 85

def path
	@path ||= @presentation.path_to(@el)
end

#propertiesObject



21
22
23
# File 'lib/ruic/assets.rb', line 21

def properties
	self.class.properties
end

#slide?Boolean

Returns:

  • (Boolean)


67
68
69
# File 'lib/ruic/assets.rb', line 67

def slide?
	false
end

#slidesObject



75
76
77
# File 'lib/ruic/assets.rb', line 75

def slides
	presentation.slides_for(@el)
end

#to_sObject



124
125
126
# File 'lib/ruic/assets.rb', line 124

def to_s
	"<#{type} #{path}>"
end

#to_xmlObject



117
118
119
# File 'lib/ruic/assets.rb', line 117

def to_xml
	@el.to_xml
end

#typeObject



36
37
38
39
# File 'lib/ruic/assets.rb', line 36

def type
	self.class.name
	# self.class.name.split('::').last
end