Module: Waiter::DSL

Included in:
Menu
Defined in:
lib/waiter/dsl.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/waiter/dsl.rb', line 13

def method_missing(name, *args, &block)
  return context.send(name, *args, &block) if context.respond_to?(name)

  path = args.shift
  options = args.extract_options!

  if path.is_a?(Hash) && !(path.key?(:controller) || path.key?(:action))
    options, path = path, nil
  end

  options[:controllers] ||= []
  add(name, path, options, &block)
  return nil
end

Instance Method Details

#column(options = {}, &block) ⇒ Object



9
10
11
# File 'lib/waiter/dsl.rb', line 9

def column(options = {}, &block)
  add_column(options, &block)
end

#section(options = {}, &block) ⇒ Object



5
6
7
# File 'lib/waiter/dsl.rb', line 5

def section(options = {}, &block)
  add_section(options, &block)
end