Class: Palaver::DialogFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/palaver/dialog_factory.rb

Constant Summary collapse

@@dialog_types =
{
  :calendar => Calendar,
  :checklist => Checklist,
  :radiolist => Radiolist,
  :menu => Menu,
  :yesno => YesNo,
  :textbox => TextBox,
  :msgbox => MsgBox,
  :inputbox => InputBox,
  :infobox => InfoBox,
  :pause => Pause,
  :passwordbox => PasswordBox,
  :dselect => DSelect,
  :fselect => FSelect,
  :form => Form
}

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(methodsym, *args, &block) ⇒ Object (private)



25
26
27
28
29
30
31
32
33
# File 'lib/palaver/dialog_factory.rb', line 25

def method_missing(methodsym, *args, &block)
  if @@dialog_types.has_key? methodsym then
    c = @@dialog_types[methodsym]
    options = args.size == 1 ? args[0] : {}
    return make_dialog(c, options, &block)
  else
    raise NoMethodError.new("Undefined method: #{methodsym} for #{self}", methodsym)
  end
end