Class: FlashTool::Flash
- Inherits:
-
Object
- Object
- FlashTool::Flash
- Defined in:
- lib/flash_tool/flash.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#info ⇒ Object
readonly
Hash with informations about generated file.
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#output_path ⇒ Object
readonly
Path to file.
Instance Method Summary collapse
-
#initialize(input, command, tempfile = nil) {|_self| ... } ⇒ Flash
constructor
This is basic method for generating command in swf tools ==Example something = Flash.new(“document.pdf”,“pdf2swf”)do |f| f.rate(24) f.save(“outputs.swf” end.
-
#method_missing(symbol, *args) ⇒ Object
Setting options from command List of commands and options can find here wiki.swftools.org/index.php/Main_Page Optins with “-” can’t be executed in shorter form.
-
#save(output_path = nil) ⇒ Object
Save swf file from documents This method creates and run command Output path can be defined in save method or in method output before otherwise default file name will be same as input name document with swf extension.
Constructor Details
#initialize(input, command, tempfile = nil) {|_self| ... } ⇒ Flash
This is basic method for generating command in swf tools
Example
something = Flash.new("document.pdf","pdf2swf")do |f|
f.rate(24)
f.save("outputs.swf"
end
It is much easer to use other classes *FlashObject - for work converting from other formats *FlashScirpt - for generating files from scripts *FlashCombine - for combining files
29 30 31 32 33 34 35 36 |
# File 'lib/flash_tool/flash.rb', line 29 def initialize(input, command ,tempfile = nil, &block) @args = [] @tempfile = tempfile @input = input @command = command yield self if block_given? raise FlashToolError, "File not found" unless File.exist?(input) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(symbol, *args) ⇒ Object
Setting options from command List of commands and options can find here wiki.swftools.org/index.php/Main_Page Optins with “-” can’t be executed in shorter form
56 57 58 59 60 |
# File 'lib/flash_tool/flash.rb', line 56 def method_missing(symbol, *args) @output_path = args.to_s if symbol.to_s == "output" @args << ("--#{symbol}") @args +=(args) end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
7 8 9 |
# File 'lib/flash_tool/flash.rb', line 7 def args @args end |
#info ⇒ Object (readonly)
Hash with informations about generated file
13 14 15 |
# File 'lib/flash_tool/flash.rb', line 13 def info @info end |
#input ⇒ Object (readonly)
Returns the value of attribute input.
6 7 8 |
# File 'lib/flash_tool/flash.rb', line 6 def input @input end |
#output_path ⇒ Object (readonly)
Path to file
10 11 12 |
# File 'lib/flash_tool/flash.rb', line 10 def output_path @output_path end |
Instance Method Details
#save(output_path = nil) ⇒ Object
Save swf file from documents This method creates and run command Output path can be defined in save method or in method output before otherwise default file name will be same as input name document with swf extension
44 45 46 47 48 |
# File 'lib/flash_tool/flash.rb', line 44 def save(output_path=nil) to_output_path(output_path) run_command(@command,*@args << @input) @info = FlashTool.flash_info(@output_path) end |