Class: Twat::Twat

Inherits:
Object
  • Object
show all
Includes:
HandledExceptions
Defined in:
lib/twat.rb,
lib/twat/config.rb

Instance Method Summary collapse

Methods included from HandledExceptions

#with_handled_exceptions

Instance Method Details

#cli_runObject



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/twat.rb', line 59

def cli_run
  # FIXME Handing in the opts like this feels dirty
  with_handled_exceptions(ArgParse.new) do |opts|
    if opts[:account] && opts[:action] != :add
      config. = opts[:account]
    end

    require 'readline-ng'
    actor = Actions.new


    actor.config = config
    actor.opts = opts
    actor.send(opts.options[:action])
  end
end

#configObject



10
11
12
# File 'lib/twat/config.rb', line 10

def config
  @config ||= Config.new
end

#configure {|config| ... } ⇒ Object

Yields:



3
4
5
6
7
8
# File 'lib/twat/config.rb', line 3

def configure(&block)
  yield config

  # If I understand correctly, I can check over what's
  # happened here?
end