Class: PixelCurtain::Curtain
- Inherits:
-
Object
- Object
- PixelCurtain::Curtain
- Includes:
- Magick
- Defined in:
- lib/pixel_curtain/curtain.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(file_path) ⇒ Curtain
constructor
A new instance of Curtain.
-
#process(options = {}) ⇒ Object
Do nothing, this is to be implemented by subclasses.
- #save(file_name, options = {}) ⇒ Object
Constructor Details
#initialize(file_path) ⇒ Curtain
Returns a new instance of Curtain.
7 8 9 10 |
# File 'lib/pixel_curtain/curtain.rb', line 7 def initialize(file_path) @source_image = Image.read(file_path).first @output = Image.new(1440,900) end |
Instance Method Details
#process(options = {}) ⇒ Object
Do nothing, this is to be implemented by subclasses
13 14 15 |
# File 'lib/pixel_curtain/curtain.rb', line 13 def process( = {}) @output end |
#save(file_name, options = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/pixel_curtain/curtain.rb', line 17 def save(file_name, = {}) [:temp_file] = false if [:temp_file].nil? if [:temp_file] output_file = Tempfile.new(['pixel_curtain', 'png']) else output_file = File.new(file_name, 'w') end @output.write("png:" + output_file.path) return output_file end |