Module: Neutrino::Processing::Nano

Defined in:
lib/neutrino/processing/nano.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cachedObject

Returns the value of attribute cached.



6
7
8
# File 'lib/neutrino/processing/nano.rb', line 6

def cached
  @cached
end

Instance Method Details

#convert!(format) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/neutrino/processing/nano.rb', line 8

def convert!(format)
  pathname = converted_pathname(format)

  manipulate!('-format', format)

  if pathname != File.expand_path(cached.path)
    File.delete(cached)

    self.cached = File.open(pathname)
  end
end

#manipulate!(*arguments) ⇒ Object



24
25
26
27
28
# File 'lib/neutrino/processing/nano.rb', line 24

def manipulate!(*arguments)
  pid = Kernel.spawn(build_command(arguments))

  Process.wait(pid)
end

#resize!(dimensions) ⇒ Object



20
21
22
# File 'lib/neutrino/processing/nano.rb', line 20

def resize!(dimensions)
  manipulate!('-resize', dimensions)
end