Class: UIC::Asset::Root
- Inherits:
-
Object
- Object
- UIC::Asset::Root
- Extended by:
- Enumerable
- Defined in:
- lib/ruic/assets.rb
Class Attribute Summary collapse
-
.name ⇒ Object
readonly
Returns the value of attribute name.
Instance Attribute Summary collapse
-
#el ⇒ Object
Returns the value of attribute el.
-
#presentation ⇒ Object
Returns the value of attribute presentation.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
-
#[](attribute_name, slide_name_or_index = nil) ⇒ Object
Get the value(s) of an attribute.
- #[]=(attribute_name, slide_name_or_index = nil, new_value) ⇒ Object
- #at(sub_path) ⇒ Object (also: #/)
- #children ⇒ Object
-
#component ⇒ Object
Find the owning component (even if you are a component).
- #component? ⇒ Boolean
- #find(criteria = {}, &block) ⇒ Object
- #has_slide?(slide_name_or_index) ⇒ Boolean
-
#initialize(presentation, element) ⇒ Root
constructor
A new instance of Root.
- #inspect ⇒ Object
- #master? ⇒ Boolean
- #name ⇒ Object
- #name=(new_name) ⇒ Object
- #on_slide(slide_name_or_index) ⇒ Object
- #parent ⇒ Object
- #path ⇒ Object
- #properties ⇒ Object
- #slide? ⇒ Boolean
- #slides ⇒ Object
- #to_s ⇒ Object
- #to_xml ⇒ Object
- #type ⇒ Object
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
.name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/ruic/assets.rb', line 6 def name @name end |
Instance Attribute Details
#el ⇒ Object
Returns the value of attribute el.
30 31 32 |
# File 'lib/ruic/assets.rb', line 30 def el @el end |
#presentation ⇒ Object
Returns the value of attribute presentation.
30 31 32 |
# File 'lib/ruic/assets.rb', line 30 def presentation @presentation end |
Class Method Details
.each ⇒ Object
11 12 13 |
# File 'lib/ruic/assets.rb', line 11 def each (@by_name.values - [self]).each{ |klass| yield klass } end |
.inspect ⇒ Object
16 17 18 |
# File 'lib/ruic/assets.rb', line 16 def inspect "<#{@name}>" end |
.properties ⇒ Object
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, =nil) if property = properties[attribute_name] if property.get( self, ) if () else UIC::ValuesPerSlide.new(@presentation,self,property) end end end |
#[]=(attribute_name, slide_name_or_index = nil, new_value) ⇒ Object
111 112 113 114 115 |
# File 'lib/ruic/assets.rb', line 111 def []=( attribute_name, =nil, new_value ) if property = properties[attribute_name] then property.set(self,new_value,) 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 |
#children ⇒ Object
45 46 47 |
# File 'lib/ruic/assets.rb', line 45 def children presentation.child_assets(@el) end |
#component ⇒ Object
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
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
71 72 73 |
# File 'lib/ruic/assets.rb', line 71 def () presentation.(@el,) end |
#inspect ⇒ Object
120 121 122 |
# File 'lib/ruic/assets.rb', line 120 def inspect "<asset #{@el.name}##{@el['id']}>" end |
#master? ⇒ Boolean
63 64 65 |
# File 'lib/ruic/assets.rb', line 63 def master? presentation.master?(@el) end |
#name ⇒ Object
89 90 91 |
# File 'lib/ruic/assets.rb', line 89 def name properties['name'].get( self, presentation.(@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.(@el) ) end |
#on_slide(slide_name_or_index) ⇒ Object
79 80 81 82 83 |
# File 'lib/ruic/assets.rb', line 79 def () if () UIC::SlideValues.new( self, ) end end |
#parent ⇒ Object
41 42 43 |
# File 'lib/ruic/assets.rb', line 41 def parent presentation.parent_asset(@el) end |
#path ⇒ Object
85 86 87 |
# File 'lib/ruic/assets.rb', line 85 def path @path ||= @presentation.path_to(@el) end |
#properties ⇒ Object
21 22 23 |
# File 'lib/ruic/assets.rb', line 21 def properties self.class.properties end |
#slide? ⇒ Boolean
67 68 69 |
# File 'lib/ruic/assets.rb', line 67 def false end |
#slides ⇒ Object
75 76 77 |
# File 'lib/ruic/assets.rb', line 75 def presentation.(@el) end |
#to_s ⇒ Object
124 125 126 |
# File 'lib/ruic/assets.rb', line 124 def to_s "<#{type} #{path}>" end |
#to_xml ⇒ Object
117 118 119 |
# File 'lib/ruic/assets.rb', line 117 def to_xml @el.to_xml end |
#type ⇒ Object
36 37 38 39 |
# File 'lib/ruic/assets.rb', line 36 def type self.class.name # self.class.name.split('::').last end |