Class: Collada::Parser::Parameter
- Inherits:
-
Object
- Object
- Collada::Parser::Parameter
- Defined in:
- lib/collada/parser/support.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, type) ⇒ Parameter
constructor
A new instance of Parameter.
- #read(value) ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize(name, type) ⇒ Parameter
Returns a new instance of Parameter.
158 159 160 161 |
# File 'lib/collada/parser/support.rb', line 158 def initialize(name, type) @name = name ? name.to_sym : nil @type = type end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
163 164 165 |
# File 'lib/collada/parser/support.rb', line 163 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
164 165 166 |
# File 'lib/collada/parser/support.rb', line 164 def type @type end |
Class Method Details
.parse(doc, element) ⇒ Object
174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/collada/parser/support.rb', line 174 def self.parse(doc, element) name = element.attributes['name'] type = element.attributes['type'] case type when /float(\d)x(\d)/ MatrixParameter.new(name, type, [$1.to_i, $2.to_i]) when /float(\d)/ VectorParameter.new(name, type, [$1.to_i, $2.to_i]) else Parameter.new(name, type) end end |
Instance Method Details
#read(value) ⇒ Object
170 171 172 |
# File 'lib/collada/parser/support.rb', line 170 def read value value.first end |
#size ⇒ Object
166 167 168 |
# File 'lib/collada/parser/support.rb', line 166 def size 1 end |