Class: PostCL::Session

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(doc_parse) ⇒ Session

Returns a new instance of Session.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/postcl.rb', line 13

def initialize(doc_parse)
  @args = doc_parse
  @prompt = TTY::Prompt.new
  @store = Store.new(self)

  @store.promt_list if @args["--lijst"]

  Command.validate_args(@args)

  begin
    Command.run(self)
  rescue Command::UnknownCommandError
    puts "ongelding commando"
  end
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



11
12
13
# File 'lib/postcl.rb', line 11

def args
  @args
end

#promptObject (readonly)

Returns the value of attribute prompt.



11
12
13
# File 'lib/postcl.rb', line 11

def prompt
  @prompt
end

#storeObject (readonly)

Returns the value of attribute store.



11
12
13
# File 'lib/postcl.rb', line 11

def store
  @store
end

Instance Method Details

#error_exit(msg) ⇒ Object



29
30
31
32
# File 'lib/postcl.rb', line 29

def error_exit(msg)
  puts msg
  exit 1
end