Class: Merb::Router::ResourceBehavior

Inherits:
Behavior show all
Defined in:
lib/merb-core/dispatch/router/resources.rb

Overview

Adding the collection and member methods to behavior

Instance Method Summary collapse

Methods inherited from Behavior

#_with_proxy, #capture, #default, #default_routes, #defer, #defer_to, #fixatable, #full_name, #identify, #match, #name, #namespace, #redirect, #to

Methods included from Resources

#resource, #resources

Constructor Details

#initialize(builders, *args) ⇒ ResourceBehavior

:api: private



305
306
307
308
309
# File 'lib/merb-core/dispatch/router/resources.rb', line 305

def initialize(builders, *args)
  super(*args)
  @collection = builders[:collection]
  @member     = builders[:member]
end

Instance Method Details

#collection(action, options = {}) ⇒ Object

:api: private



312
313
314
315
316
317
# File 'lib/merb-core/dispatch/router/resources.rb', line 312

def collection(action, options = {})
  action = action.to_s
  method = options[:method]
  to     = options[:to] || action
  @collection[action, to, method]
end

#member(action, options = {}) ⇒ Object

:api: private



320
321
322
323
324
325
# File 'lib/merb-core/dispatch/router/resources.rb', line 320

def member(action, options = {})
  action = action.to_s
  method = options[:method]
  to     = options[:to] || action
  @member[action, to, method]
end