Class: Minglr::Action

Inherits:
Object
  • Object
show all
Defined in:
lib/minglr/action.rb

Defined Under Namespace

Classes: Commands

Class Method Summary collapse

Class Method Details

.execute(action, options = [], flag_options = {}, config = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/minglr/action.rb', line 5

def self.execute(action, options = [], flag_options = {}, config = {})
  if action.to_s == options[0]
    options.shift
  else
    options.shift
    options.shift
  end
  begin
    Commands.send(action, options, flag_options, config)
  rescue ActiveResource::ResourceNotFound => error
    puts error.message + " for URL '#{Resources::Base.site}' ..."
  end
end

.valid_action?(action) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/minglr/action.rb', line 23

def self.valid_action?(action)
  valid_actions.include? action
end

.valid_actionsObject



19
20
21
# File 'lib/minglr/action.rb', line 19

def self.valid_actions
  Commands.methods(false)
end