Class: IParty::CLI::Application::IrbContext
- Inherits:
-
Object
- Object
- IParty::CLI::Application::IrbContext
- Defined in:
- lib/iparty/cli/application/irb_context.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#formatter ⇒ Object
readonly
Returns the value of attribute formatter.
Instance Method Summary collapse
- #help ⇒ Object
-
#initialize(app) ⇒ IrbContext
constructor
A new instance of IrbContext.
- #ip(*ips) ⇒ Object
- #start ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(app) ⇒ IrbContext
Returns a new instance of IrbContext.
9 10 11 |
# File 'lib/iparty/cli/application/irb_context.rb', line 9 def initialize(app) @app = app end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
7 8 9 |
# File 'lib/iparty/cli/application/irb_context.rb', line 7 def app @app end |
#formatter ⇒ Object (readonly)
Returns the value of attribute formatter.
7 8 9 |
# File 'lib/iparty/cli/application/irb_context.rb', line 7 def formatter @formatter end |
Instance Method Details
#help ⇒ Object
17 18 19 20 21 |
# File 'lib/iparty/cli/application/irb_context.rb', line 17 def help puts "app # application reference" puts "exit # exit IRB" puts "ip *ips # show summary for IPs" end |
#ip(*ips) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/iparty/cli/application/irb_context.rb', line 23 def ip *ips addresses = IParty.(ips) @app.out << if addresses.length > 1 app.formatter.format_all(addresses){|ip| app.ip_to_data(ip, colorize: app.formatter.colorize?) } else [app.formatter.format(addresses[0]){|ip| app.ip_to_data(ip, colorize: app.formatter.colorize?) }] end nil end |
#start ⇒ Object
34 35 36 37 |
# File 'lib/iparty/cli/application/irb_context.rb', line 34 def start help binding.irb(show_code: false) # rubocop:disable Lint/Debugger -- no comment end |
#to_s ⇒ Object
13 14 15 |
# File 'lib/iparty/cli/application/irb_context.rb', line 13 def to_s "IParty::CLI" end |