Sha256: b6f2406ecec379bcf664b40cf88318183ff163da59e3572f5832854fced51b05
Contents?: true
Size: 910 Bytes
Versions: 2
Compression:
Stored size: 910 Bytes
Contents
require "dragonfly/image_magick/commands" require "dragonfly/param_validators" module Dragonfly module ImageMagick module Generators class Plain include ParamValidators def call(content, width, height, opts = {}) validate_all!([width, height], &is_number) validate_all_keys!(opts, %w(colour color format), &is_word) format = extract_format(opts) colour = opts["colour"] || opts["color"] || "white" Commands.generate(content, "-size #{width}x#{height} xc:#{colour}", format) content.add_meta("format" => format, "name" => "plain.#{format}") end def update_url(url_attributes, width, height, opts = {}) url_attributes.name = "plain.#{extract_format(opts)}" end private def extract_format(opts) opts["format"] || "png" end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dragonfly-1.4.1 | lib/dragonfly/image_magick/generators/plain.rb |
dragonfly-1.4.0 | lib/dragonfly/image_magick/generators/plain.rb |