Class: Traptcha::Image
- Inherits:
-
Object
- Object
- Traptcha::Image
- Defined in:
- lib/traptcha/image.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(text, options = {}) ⇒ Image
constructor
A new instance of Image.
- #output ⇒ Object
- #save(path) ⇒ Object
Constructor Details
#initialize(text, options = {}) ⇒ Image
Returns a new instance of Image.
5 6 7 8 9 10 |
# File 'lib/traptcha/image.rb', line 5 def initialize(text, = {}) @text = text @canvas = ::Magick::Image.new(Traptcha.default_width, Traptcha.default_height) @canvas.format = "PNG" = end |
Instance Method Details
#output ⇒ Object
16 17 18 19 |
# File 'lib/traptcha/image.rb', line 16 def output generate @canvas end |
#save(path) ⇒ Object
12 13 14 |
# File 'lib/traptcha/image.rb', line 12 def save(path) output.write(File.join(path, @text + ".png")) end |