Class: Beats::Command::Base Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/beats/commands/base.rb

Overview

This class is abstract.

Beats::Command::Base is the base class for all commands. subclass it and add public methods that will become commands. Methods named like the subclass will become the default command for that command group.

Direct Known Subclasses

Account, Api, Auth, Help, Ingest, Sentence, Stream, Version

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Base

Returns a new instance of Base.



15
16
17
# File 'lib/beats/commands/base.rb', line 15

def initialize(*args)
  @args = args
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



13
14
15
# File 'lib/beats/commands/base.rb', line 13

def args
  @args
end

Class Method Details

.has_command?(command) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
22
23
24
25
# File 'lib/beats/commands/base.rb', line 19

def self.has_command?(command)
  if self.instance_methods.first.is_a?(Symbol)
    self.instance_methods.include?(command.to_sym)
  else
    self.instance_methods.include?(command.to_s)
  end
end