lib/nakal/base_screen.rb in nakal-0.0.1 vs lib/nakal/base_screen.rb in nakal-0.0.2
- old
+ new
@@ -4,18 +4,13 @@
attr_accessor :image, :name
def initialize file_name, mode = :load, image = nil
@name = file_name
- if mode.eql?(:capture)
- capture
- load_image_from_file
- elsif mode.eql?(:load)
- load_image_from_file
- else
- @image=image
- end
+ @image = image
+ capture if mode.eql?(:capture)
+ image.nil? ? @image = Magick::Image.read("#{Nakal.image_location}/#{@name}.png")[0] : @image=image
end
def strip
crop_params = Nakal.default_crop_params[Nakal.device_name]
if crop_params.nil?
@@ -41,15 +36,9 @@
FileUtils.rm "#{Nakal.image_location}/#{@name}.png"
end
def save
@image.write("#{Nakal.image_location}/#{@name}.png")
- end
-
- private
-
- def load_image_from_file
- @image = Magick::Image.read("#{Nakal.image_location}/#{@name}.png")[0]
end
end
end
end