Class: Imforger

Inherits:
Object
  • Object
show all
Defined in:
lib/imforger.rb,
ext/imforger/imforger.c

Defined Under Namespace

Classes: Exception

Constant Summary collapse

VERSION =
'0.2.2'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Imforger

Returns a new instance of Imforger.



10
11
12
13
14
15
16
# File 'lib/imforger.rb', line 10

def initialize(path)
  path = File.expand_path(path)

  raise(Imforger::Exception, "Input file not found!") unless File.exists?(path)
  @input_image = path
  @options = {}
end

Instance Attribute Details

#input_imageObject

Returns the value of attribute input_image.



6
7
8
# File 'lib/imforger.rb', line 6

def input_image
  @input_image
end

#optionsObject

Returns the value of attribute options.



6
7
8
# File 'lib/imforger.rb', line 6

def options
  @options
end

#output_imageObject

Returns the value of attribute output_image.



6
7
8
# File 'lib/imforger.rb', line 6

def output_image
  @output_image
end

Instance Method Details

#to_file(output_path, opts = {}) ⇒ Object



18
19
20
21
22
23
# File 'lib/imforger.rb', line 18

def to_file(output_path, opts = {})
  @options.merge!(opts)
  check_format

  save_file(File.expand_path(output_path))
end