Class: Texture3mf
- Inherits:
-
Object
- Object
- Texture3mf
- Defined in:
- lib/ruby3mf/texture3mf.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #contents ⇒ Object
-
#initialize(document) ⇒ Texture3mf
constructor
A new instance of Texture3mf.
- #update(bytes) ⇒ Object
Constructor Details
#initialize(document) ⇒ Texture3mf
Returns a new instance of Texture3mf.
4 5 6 |
# File 'lib/ruby3mf/texture3mf.rb', line 4 def initialize(document) @doc = document end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/ruby3mf/texture3mf.rb', line 2 def name @name end |
Class Method Details
.parse(document, relationship_file) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/ruby3mf/texture3mf.rb', line 8 def self.parse(document, relationship_file) t = new(document) t.name = relationship_file.name stream = relationship_file.get_input_stream img_type = MimeMagic.by_magic(stream) Log3mf.context "Texture3mf" do |l| l.fatal_error :zero_size_texture unless img_type l.debug "texture is of type: #{img_type}" l.error(:invalid_texture_file_type, type: img_type) unless ['image/png', 'image/jpeg'].include? img_type.type end t end |
Instance Method Details
#contents ⇒ Object
25 26 27 |
# File 'lib/ruby3mf/texture3mf.rb', line 25 def contents @doc.objects[name] || @doc.contents_for(name) end |
#update(bytes) ⇒ Object
21 22 23 |
# File 'lib/ruby3mf/texture3mf.rb', line 21 def update(bytes) @doc.objects[name]=bytes end |