Class: Elasticshell::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/elasticshell/command.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#inputObject

Returns the value of attribute input.



5
6
7
# File 'lib/elasticshell/command.rb', line 5

def input
  @input
end

#shellObject

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

Returns:

  • (Boolean)

Raises:



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

Raises:



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