Class: Elasticshell::Command
- Inherits:
-
Object
- Object
- Elasticshell::Command
- Defined in:
- lib/elasticshell/command.rb
Direct Known Subclasses
Elasticshell::Commands::Blank, Elasticshell::Commands::Cd, Elasticshell::Commands::Connect, Elasticshell::Commands::Df, Elasticshell::Commands::Exit, Elasticshell::Commands::Help, Elasticshell::Commands::Ls, Elasticshell::Commands::Pretty, Elasticshell::Commands::Pwd, Elasticshell::Commands::Request, Elasticshell::Commands::SetVerb, Elasticshell::Commands::Unknown
Instance Attribute Summary collapse
-
#input ⇒ Object
Returns the value of attribute input.
-
#shell ⇒ Object
Returns the value of attribute shell.
Class Method Summary collapse
Instance Method Summary collapse
- #be_connected! ⇒ Object
- #evaluate! ⇒ Object
-
#initialize(shell, input) ⇒ Command
constructor
A new instance of Command.
Constructor Details
#initialize(shell, input) ⇒ Command
Returns a new instance of Command.
7 8 9 10 |
# File 'lib/elasticshell/command.rb', line 7 def initialize shell, input self.shell = shell self.input = input end |
Instance Attribute Details
#input ⇒ Object
Returns the value of attribute input.
5 6 7 |
# File 'lib/elasticshell/command.rb', line 5 def input @input end |
#shell ⇒ Object
Returns the value of attribute shell.
5 6 7 |
# File 'lib/elasticshell/command.rb', line 5 def shell @shell end |
Class Method Details
.matches?(input) ⇒ Boolean
12 13 14 |
# File 'lib/elasticshell/command.rb', line 12 def self.matches? input raise NotImplementedError.new("Define the 'matches?' method on #{self.class}") end |
Instance Method Details
#be_connected! ⇒ Object
16 17 18 |
# File 'lib/elasticshell/command.rb', line 16 def be_connected! raise ClientError.new("Not connected to any Elasticsearch servers. Try running\n\n\t#{shell.prompt}connect URI [URI] ...\n\n") unless shell.connected? end |
#evaluate! ⇒ Object
20 21 22 |
# File 'lib/elasticshell/command.rb', line 20 def evaluate! raise NotImplementedError.new("Define the 'evaluate!' instance method in your subclass of #{self.class}") end |