Class: Webbynode::ActionCommand

Inherits:
Command show all
Defined in:
lib/webbynode/action_command.rb

Direct Known Subclasses

Commands::Database

Constant Summary

Constants inherited from Command

Command::Aliases, Command::CommandError, Command::InvalidCommand, Command::InvalidOption, Command::Settings

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

add_alias, #api, class_for, command, command_class_name, description, for, #gemfile, #git, help, inherited, #initialize, #io, #no?, #notify, option, #option, #options, options_help, #param, #param_values, parameter, #params, #params_hash, params_help, #pushand, #remote_executor, requires_initialization!, requires_options!, requires_pushed_application!, #run, #server, setting, #settings, summary, summary_help, usage, #validate_initialization, #validate_options, #yes?

Constructor Details

This class inherits a constructor from Webbynode::Command

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



3
4
5
# File 'lib/webbynode/action_command.rb', line 3

def action
  @action
end

Class Method Details

.allowed_actions(actions) ⇒ Object



5
6
7
8
9
# File 'lib/webbynode/action_command.rb', line 5

def self.allowed_actions(actions)
  self.parameter :action, String, actions.join(", "), 
    :validate => { :in => actions },
    :required => false
end

Instance Method Details

#executeObject



11
12
13
14
# File 'lib/webbynode/action_command.rb', line 11

def execute
  @action = param(:action) || "default"
  send(action)
end