Module: Prometheus::Repl::Command
- Defined in:
- lib/prometheus/repl/command.rb
Class Method Summary collapse
- .[](name) ⇒ Object
- .command_names ⇒ Object
- .commands ⇒ Object
- .define(*names, &block) ⇒ Object
- .find(line) ⇒ Object
Class Method Details
.[](name) ⇒ Object
28 29 30 |
# File 'lib/prometheus/repl/command.rb', line 28 def [](name) commands[name.to_sym] end |
.command_names ⇒ Object
24 25 26 |
# File 'lib/prometheus/repl/command.rb', line 24 def command_names commands.keys end |
.commands ⇒ Object
6 7 8 |
# File 'lib/prometheus/repl/command.rb', line 6 def commands @commands ||= {} end |
.define(*names, &block) ⇒ Object
10 11 12 13 14 |
# File 'lib/prometheus/repl/command.rb', line 10 def define(*names, &block) names.each do |name| commands[name.to_sym] = block end end |
.find(line) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/prometheus/repl/command.rb', line 16 def find(line) if name = line.split(/\s+/, 2)[0] commands[name.to_sym] else nil end end |