lib/apitizer/routing/map.rb in apitizer-0.0.2 vs lib/apitizer/routing/map.rb in apitizer-0.0.3
- old
+ new
@@ -19,20 +19,22 @@
def define(&block)
proxy = Proxy.new(self)
proxy.instance_eval(&block)
end
- def define_resources(name, parent: @root, **options, &block)
- child = Node::Collection.new(name, **options)
+ def define_resources(name, options, &block)
+ parent = options.delete(:parent) || @root
+ child = Node::Collection.new(name, options)
parent.append(child)
return unless block_given?
proxy = Proxy.new(self, parent: child)
proxy.instance_eval(&block)
end
Apitizer.actions.each do |action|
- define_method "define_#{ action }" do |name, parent:, **options|
- child = Node::Operation.new(name, action: action, **options)
+ define_method "define_#{ action }" do |name, options|
+ parent = options.delete(:parent)
+ child = Node::Operation.new(name, options.merge(action: action))
parent.append(child)
end
end
end
end