Module: ElFinder2::Command

Defined in:
lib/el_finder2/command.rb,
lib/el_finder2/command/rm.rb,
lib/el_finder2/command/dim.rb,
lib/el_finder2/command/tmb.rb,
lib/el_finder2/command/base.rb,
lib/el_finder2/command/file.rb,
lib/el_finder2/command/open.rb,
lib/el_finder2/command/size.rb,
lib/el_finder2/command/tree.rb,
lib/el_finder2/command/mkdir.rb,
lib/el_finder2/command/rename.rb,
lib/el_finder2/command/resize.rb,
lib/el_finder2/command/upload.rb,
lib/el_finder2/command/parents.rb,
lib/el_finder2/command/duplicate.rb

Defined Under Namespace

Classes: Base, Dim, Duplicate, File, Mkdir, Open, Parents, Rename, Resize, Rm, Size, Tmb, Tree, Upload

Class Method Summary collapse

Class Method Details

.dispatch(controller, params) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/el_finder2/command.rb', line 19

def self.dispatch(controller, params)
  verb = params.delete(:cmd)

  fail ElFinder2::Error.new('No command specified') unless verb

  command_class = verb.capitalize
  command_implemented = const_defined?(command_class)

  fail ElFinder2::Error.new("Unrecognized command: #{verb}") unless command_implemented

  command = const_get(command_class)

  command.new(controller, params).execute
end