class TextToImage
Makes an image from the text given
Constants
- DEFAULT_OPTS
Attributes
options[RW]
text[RW]
Public Class Methods
new(text, options = {})
click to toggle source
# File lib/text_to_image.rb, line 15 def initialize(text, options = {}) @text = text @options = DEFAULT_OPTS.merge options end
Public Instance Methods
raw()
click to toggle source
# File lib/text_to_image.rb, line 20 def raw data end
Private Instance Methods
data()
click to toggle source
# File lib/text_to_image.rb, line 28 def data MiniMagick::Tool::Convert.new do |img| img.size size img.caption text img.rotate(options[:rotate]) if options[:rotate].present? img << "#{options[:format]}:-" end end
size()
click to toggle source
# File lib/text_to_image.rb, line 37 def size [options[:width].to_s, options[:height].to_s].join('x') end