Class: FlashTool::FlashObject
- Defined in:
- lib/flash_tool/flash_object.rb
Instance Attribute Summary collapse
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Attributes inherited from Flash
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(input, type = nil, tempfile = nil, &block) ⇒ FlashObject
constructor
Input is path file with good extesnion Approved formats are : *pdf, *jpeg (jpeg and jpg extension), *png, *gif, *fonts (ttf, afm, pfa, pfb formats) and *wav (wav funcionality is untested and you can often will have problems with SWFTools installation and with command wav2swf).
Methods inherited from Flash
Constructor Details
#initialize(input, type = nil, tempfile = nil, &block) ⇒ FlashObject
Input is path file with good extesnion Approved formats are : *pdf, *jpeg (jpeg and jpg extension), *png, *gif, *fonts (ttf, afm, pfa, pfb formats) and *wav (wav funcionality is untested and you can often will have problems with SWFTools installation and with command wav2swf)
type - is extension name string if your input file have other extension
Example
flash = FlashOjbect.new('path_to_file', 'png')
flash = FlashOjbect.new('path_to_file.jpg') do |f|
f.quality(80)
f.rate('24')
f.save('outputh_path')
end
Raise exceptions
28 29 30 31 32 33 |
# File 'lib/flash_tool/flash_object.rb', line 28 def initialize(input, type = nil, tempfile = nil, &block) @type = type || input.split('.').last @command = type_parser @type super(input,@command,tempfile,&block) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class FlashTool::Flash
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
5 6 7 |
# File 'lib/flash_tool/flash_object.rb', line 5 def input @input end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/flash_tool/flash_object.rb', line 4 def type @type end |
Class Method Details
.from_blob(blob, ext, &block) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/flash_tool/flash_object.rb', line 36 def self.from_blob(blob, ext, &block) begin tempfile = Tempfile.new(['flash_tool', ext.to_s]) tempfile.binmode tempfile.write(blob) ensure tempfile.close if tempfile end return self.new(tempfile.path, ext ,tempfile, &block) end |