Class: Yetty::Command

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

Overview

Abstract command class

Direct Known Subclasses

Play, Push, Record, Site, User

Constant Summary collapse

DEFAULT_CONFIGURATION_FILES =

Default configuration file locations

[
  './.yetty',
  '~/.yetty',
  '/etc/yetty/config.json'
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts, args) ⇒ self

Build new command instance



24
25
26
27
28
29
# File 'lib/yetty/command.rb', line 24

def initialize(opts, args)
  @options = opts.to_smash
  @arguments = args
  @ui = Ui.new
  load_config!
end

Instance Attribute Details

#argumentsArray (readonly)

Returns cli arguments.

Returns:

  • (Array)

    cli arguments



10
11
12
# File 'lib/yetty/command.rb', line 10

def arguments
  @arguments
end

#optionsHash (readonly)

Returns options.

Returns:

  • (Hash)

    options



8
9
10
# File 'lib/yetty/command.rb', line 8

def options
  @options
end

#uiUi (readonly)

Returns:



12
13
14
# File 'lib/yetty/command.rb', line 12

def ui
  @ui
end

Instance Method Details

#execute!TrueClass

Execute the command

Returns:

  • (TrueClass)

Raises:

  • (NotImplementedError)


34
35
36
# File 'lib/yetty/command.rb', line 34

def execute!
  raise NotImplementedError
end