Class: Raheui::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/raheui/cli.rb

Overview

Handle command line interfaces logic.

Instance Method Summary collapse

Constructor Details

#initializeCLI

Initialize a CLI.



7
8
9
# File 'lib/raheui/cli.rb', line 7

def initialize
  @options = {}
end

Instance Method Details

#run(args = ARGV) ⇒ Object

Entry point for the applicaiton logic. Process command line arguments and run the Aheui code.

args - An Array of Strings user passed.

Returns an Integer UNIX exit code.



17
18
19
20
21
22
23
24
25
26
# File 'lib/raheui/cli.rb', line 17

def run(args = ARGV)
  @options, paths = Option.new.parse(args)
  source = if paths.empty?
             $stdin.read
           else
             File.read(paths[0])
           end
  runner = Runner.new(Code.new(source))
  runner.run
end