Module: Forward::Common
- Included in:
- API::Resource, API::Resource, CLI, Forward::Command::Base, Request, Socket, Tunnel
- Defined in:
- lib/forward/common.rb
Constant Summary collapse
- EMAIL_REGEX =
/\A[^@]+@[^@]+\.[^@]+\z/.freeze
Instance Method Summary collapse
- #config ⇒ Object
- #exit_with_error(message = nil) ⇒ Object
- #exit_with_message(message = nil) ⇒ Object
- #logged_in? ⇒ Boolean
- #logger ⇒ Object (also: #log)
- #os ⇒ Object
- #stop_reactor_and_exit(code = 0) ⇒ Object
- #windows? ⇒ Boolean
Instance Method Details
#exit_with_error(message = nil) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/forward/common.rb', line 36 def exit_with_error( = nil) if puts HighLine.color(, :red) end stop_reactor_and_exit(1) end |
#exit_with_message(message = nil) ⇒ Object
26 27 28 29 |
# File 'lib/forward/common.rb', line 26 def ( = nil) puts if stop_reactor_and_exit end |
#logged_in? ⇒ Boolean
14 15 16 |
# File 'lib/forward/common.rb', line 14 def logged_in? !Config.default_account.nil? end |
#logger ⇒ Object Also known as: log
5 6 7 |
# File 'lib/forward/common.rb', line 5 def logger Forward.logger end |
#stop_reactor_and_exit(code = 0) ⇒ Object
31 32 33 34 |
# File 'lib/forward/common.rb', line 31 def stop_reactor_and_exit(code = 0) EM.stop if EM.reactor_running? exit(code) end |