public
Description: master merb branch
Homepage: http://www.merbivore.com
Clone URL: git://github.com/wycats/merb.git
100644 28 lines (23 sloc) 0.59 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
begin
  require "methopara"
rescue
  puts "Make sure you have methopara http://github.com/genki/methopara installed if you want to use action args on Ruby 1.9"
end
 
module GetArgs
  def get_args
    unless respond_to?(:parameters)
      raise NotImplementedError, "Ruby #{RUBY_VERSION} doesn't support #{self.class}#parameters"
    end
 
    required = []
    optional = []
 
    parameters.each do |(type, name)|
      if type == :opt
        required << [name, nil]
        optional << name
      else
        required << [name]
      end
    end
 
    return [required, optional]
  end
end