Class: FaviconMaker::Creator
- Inherits:
-
Object
- Object
- FaviconMaker::Creator
- Defined in:
- lib/favicon_maker/creator.rb
Constant Summary collapse
- RECENT_IM_VERSION =
"6.8.0"
Instance Attribute Summary collapse
-
#finished_block ⇒ Object
Returns the value of attribute finished_block.
-
#options ⇒ Object
Returns the value of attribute options.
-
#output_path ⇒ Object
Returns the value of attribute output_path.
-
#template_file_path ⇒ Object
Returns the value of attribute template_file_path.
Instance Method Summary collapse
- #icon(output_filename, options = {}) ⇒ Object
-
#initialize(template_file_path, output_path, options, finished_block) ⇒ Creator
constructor
A new instance of Creator.
- #run ⇒ Object
Constructor Details
#initialize(template_file_path, output_path, options, finished_block) ⇒ Creator
Returns a new instance of Creator.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/favicon_maker/creator.rb', line 13 def initialize(template_file_path, output_path, , finished_block) @template_file_path = template_file_path @output_path = output_path @options = @finished_block = finished_block @command_set = [] im_version = fetch_image_magick_version if im_version print_image_magick_ancient_version_warning(im_version) if im_version < RECENT_IM_VERSION else print_image_magick_no_version_warning end end |
Instance Attribute Details
#finished_block ⇒ Object
Returns the value of attribute finished_block.
11 12 13 |
# File 'lib/favicon_maker/creator.rb', line 11 def finished_block @finished_block end |
#options ⇒ Object
Returns the value of attribute options.
10 11 12 |
# File 'lib/favicon_maker/creator.rb', line 10 def @options end |
#output_path ⇒ Object
Returns the value of attribute output_path.
9 10 11 |
# File 'lib/favicon_maker/creator.rb', line 9 def output_path @output_path end |
#template_file_path ⇒ Object
Returns the value of attribute template_file_path.
8 9 10 |
# File 'lib/favicon_maker/creator.rb', line 8 def template_file_path @template_file_path end |
Instance Method Details
#icon(output_filename, options = {}) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/favicon_maker/creator.rb', line 29 def icon(output_filename, ={}) format = [:format] || extract_format(output_filename) size = [:size] || extract_size(output_filename) output_file_path = File.join(output_path, output_filename) validate_input(format, size) @command_set << [ generate_command(template_file_path, output_file_path, size, format), output_file_path, template_file_path ] end |
#run ⇒ Object
39 40 41 42 43 44 |
# File 'lib/favicon_maker/creator.rb', line 39 def run @command_set.map do |cmd, output_file_path, template_file_path| `#{cmd}` finished_block.call(output_file_path, template_file_path) if finished_block end end |