Class: Prize::Repl
Instance Method Summary collapse
-
#initialize ⇒ Repl
constructor
A new instance of Repl.
- #prompt ⇒ Object
Constructor Details
Instance Method Details
#prompt ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/prize/repl.rb', line 14 def prompt opts = @redis.instance_variable_get('@client'). if App..ssh_host host = "#{App..ssh_host}:#{App..host || '127.0.0.1'}:#{App..port || 6379}/#{opts[:db]}" else host = opts[:url] || opts[:path] || "#{opts[:host]}:#{opts[:port]}/#{opts[:db]}" end [proc do |obj, nest_level, _| if obj == @redis && nest_level == 0 nest_level_prompt = '' else nest_level_prompt = "(#{obj}:#{nest_level})" end "%s#{Rainbow('@').green}%s#{nest_level_prompt} %s " % [Rainbow('PRIZE').red, Rainbow(host).yellow, Rainbow('❯').green] end] end |