Sha256: 5d229ddd21aeee3ffdc75c7b2ac5377270ea8feede8b0d7f3a5a8b05de72f708
Contents?: true
Size: 1.68 KB
Versions: 4
Compression:
Stored size: 1.68 KB
Contents
module ActionDispatch::Routing class Mapper private def sockets_for(resource, options = {}) @resources = resource.to_s.underscore.pluralize.to_sym @resource = resource.to_s.underscore.singularize.to_sym if options.any? if options[:only] if options[:only].is_a? Symbol send :"draw_#{options[:only]}" elsif options[:only].is_a? Array options[:only].each do |option| send :"draw_#{option}" end end elsif options[:except] if options[:except].is_a? Symbol (default_options - [options[:except]]).each do |option| send :"draw_#{option}" end elsif options[:except].is_a? Array (default_options - options[:except]).each do |option| send :"draw_#{option}" end end end else draw_all end end def default_options [:index, :create, :show, :destroy, :update] end def draw_all draw_index draw_create draw_show draw_destroy draw_update end def draw_index get :"/#{@resources}", to: "#{@resources}#index", as: @resources end def draw_create get :"/#{@resources}/create", to: "#{@resources}#create", as: :"create_#{@resource}" end def draw_show get :"/#{@resources}/:id", to: "#{@resources}#show", as: @resource end def draw_destroy get :"/#{@resources}/:id/destroy", to: "#{@resources}#destroy", as: :"destroy_#{@resource}" end def draw_update get :"/#{@resources}/:id/update", to: "#{@resources}#update", as: :"update_#{@resource}" end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
entangled-0.0.18 | lib/entangled/routes.rb |
entangled-0.0.17 | lib/entangled/routes.rb |
entangled-0.0.16 | lib/entangled/routes.rb |
entangled-0.0.15 | lib/entangled/routes.rb |