Class: Mir::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/mir/01_runner.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.run(*arguments) ⇒ Object



7
8
9
# File 'lib/mir/01_runner.rb', line 7

def self.run *arguments
  new.run(arguments)
end

Instance Method Details

#headerObject



27
28
29
# File 'lib/mir/01_runner.rb', line 27

def header
  puts "Mir (#{VERSION}) - (c) JC Le Lann 2023"
end

#run(arguments) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/mir/01_runner.rb', line 11

def run arguments
  options = args = parse_options(arguments)
  begin
    if filename=args[:file]
      image=Mir::Image.open(filename)
      viewer=ViewerApp.new(image)
      viewer.run
    else
      raise "need a ppm file : mir [options] <file>"
    end
  rescue Exception => e
    puts e unless options[:mute]
    return false
  end
end