Class: FlatKit::Command
- Inherits:
-
Object
- Object
- FlatKit::Command
- Extended by:
- DescendantTracker
- Defined in:
- lib/flat_kit/command.rb,
lib/flat_kit/command/cat.rb,
lib/flat_kit/command/sort.rb,
lib/flat_kit/command/merge.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#argv ⇒ Object
readonly
Returns the value of attribute argv.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
-
#readers ⇒ Object
readonly
Returns the value of attribute readers.
-
#writer ⇒ Object
readonly
Returns the value of attribute writer.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(argv:, logger: ::FlatKit.logger, env: ENV) ⇒ Command
constructor
A new instance of Command.
- #parse ⇒ Object
Methods included from DescendantTracker
children, find_child, inherited
Constructor Details
Instance Attribute Details
#argv ⇒ Object (readonly)
Returns the value of attribute argv.
5 6 7 |
# File 'lib/flat_kit/command.rb', line 5 def argv @argv end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
6 7 8 |
# File 'lib/flat_kit/command.rb', line 6 def env @env end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
7 8 9 |
# File 'lib/flat_kit/command.rb', line 7 def logger @logger end |
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
8 9 10 |
# File 'lib/flat_kit/command.rb', line 8 def opts @opts end |
#readers ⇒ Object (readonly)
Returns the value of attribute readers.
9 10 11 |
# File 'lib/flat_kit/command.rb', line 9 def readers @readers end |
#writer ⇒ Object (readonly)
Returns the value of attribute writer.
10 11 12 |
# File 'lib/flat_kit/command.rb', line 10 def writer @writer end |
Class Method Details
.description ⇒ Object
16 17 18 |
# File 'lib/flat_kit/command.rb', line 16 def self.description raise NotImplementedError, "#{self.class} must implement #{self.class}.description" end |
.for(name) ⇒ Object
28 29 30 31 32 |
# File 'lib/flat_kit/command.rb', line 28 def self.for(name) children.find do |child_klass| child_klass.name == name end end |
.name ⇒ Object
12 13 14 |
# File 'lib/flat_kit/command.rb', line 12 def self.name raise NotImplementedError, "#{self.class} must implement #{self.class}.name" end |
.names ⇒ Object
24 25 26 |
# File 'lib/flat_kit/command.rb', line 24 def self.names children.map { |c| c.name } end |
.parser ⇒ Object
20 21 22 |
# File 'lib/flat_kit/command.rb', line 20 def self.parser raise NotImplementedError, "#{self.class} must implement #{self.class}.parser" end |
Instance Method Details
#call ⇒ Object
45 46 47 |
# File 'lib/flat_kit/command.rb', line 45 def call raise NotImplementedError, "#{self.class} must implement #{self.class}.description" end |
#parse ⇒ Object
41 42 43 |
# File 'lib/flat_kit/command.rb', line 41 def parse raise NotImplementedError, "#{self.class} must implement #{self.class}#parse" end |