Class: Omnium::CLI::Core

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

Defined Under Namespace

Classes: CLIError

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Core

Returns a new instance of Core.



8
9
10
# File 'lib/omnium/cli/core.rb', line 8

def initialize(args)
  @filename = args&.first
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
# File 'lib/omnium/cli/core.rb', line 12

def run
  program = IO.readlines(@filename).join

  interpret(program)
rescue TypeError => e
  raise(CLIError, '@filename is blank.')
rescue Errno::ENOENT => e
  raise(CLIError, "@filename '#{@filename}' does not exist.")
end