Class: Dragonfly::ImageMagick::Generators::Plasma

Inherits:
Object
  • Object
show all
Includes:
ParamValidators
Defined in:
lib/dragonfly/image_magick/generators/plasma.rb

Constant Summary

Constants included from ParamValidators

ParamValidators::IS_NUMBER, ParamValidators::IS_WORD, ParamValidators::IS_WORDS

Instance Method Summary collapse

Methods included from ParamValidators

is_number, is_word, is_words, validate!, validate_all!, validate_all_keys!

Instance Method Details

#call(content, width, height, opts = {}) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/dragonfly/image_magick/generators/plasma.rb', line 9

def call(content, width, height, opts = {})
  validate_all!([width, height], &is_number)
  validate!(opts["format"], &is_word)
  format = extract_format(opts)
  Commands.generate(content, "-size #{width}x#{height} plasma:fractal", format)
  content.add_meta("format" => format, "name" => "plasma.#{format}")
end

#update_url(url_attributes, width, height, opts = {}) ⇒ Object



17
18
19
# File 'lib/dragonfly/image_magick/generators/plasma.rb', line 17

def update_url(url_attributes, width, height, opts = {})
  url_attributes.name = "plasma.#{extract_format(opts)}"
end