Class: Objectify::Rails::Routing::ObjectifyMapper
- Inherits:
-
Object
- Object
- Objectify::Rails::Routing::ObjectifyMapper
- Defined in:
- lib/objectify/rails/routing.rb
Instance Method Summary collapse
- #decorators(options) ⇒ Object
- #defaults(options) ⇒ Object
- #implementations(options) ⇒ Object
-
#initialize(rails_mapper, application = ::Rails.application, action_factory = Config::Action) ⇒ ObjectifyMapper
constructor
A new instance of ObjectifyMapper.
- #legacy_action(controller, actions, options) ⇒ Object
- #match(options) ⇒ Object
- #policy_responders(options) ⇒ Object
- #resolvers(options) ⇒ Object
- #resources(*args) ⇒ Object
- #values(options) ⇒ Object
Constructor Details
#initialize(rails_mapper, application = ::Rails.application, action_factory = Config::Action) ⇒ ObjectifyMapper
Returns a new instance of ObjectifyMapper.
12 13 14 15 16 17 18 |
# File 'lib/objectify/rails/routing.rb', line 12 def initialize(rails_mapper, application = ::Rails.application, action_factory = Config::Action) @rails_mapper = rails_mapper @application = application @action_factory = action_factory end |
Instance Method Details
#decorators(options) ⇒ Object
72 73 74 |
# File 'lib/objectify/rails/routing.rb', line 72 def decorators() @application.objectify.append_decorators() end |
#defaults(options) ⇒ Object
52 53 54 |
# File 'lib/objectify/rails/routing.rb', line 52 def defaults() @application.objectify.append_defaults() end |
#implementations(options) ⇒ Object
60 61 62 |
# File 'lib/objectify/rails/routing.rb', line 60 def implementations() @application.objectify.append_implementations() end |
#legacy_action(controller, actions, options) ⇒ Object
76 77 78 79 80 81 82 |
# File 'lib/objectify/rails/routing.rb', line 76 def legacy_action(controller, actions, ) [*actions].each do |action_name| routing_opts = {:controller => controller, :action => action_name} append_action(routing_opts, controller, action_name, ) end end |
#match(options) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/objectify/rails/routing.rb', line 40 def match() from,to = .detect { |k,v| k.is_a?(String) } resource,action = to.split("#").map(&:to_sym) controller = @application.objectify.objectify_controller = () objectify_defaults = {"path" => from.dup} = merge_defaults(objectify_defaults, ) @rails_mapper.match .merge(from => "#{controller}#action") append_action(objectify_defaults, resource, action, ) end |
#policy_responders(options) ⇒ Object
56 57 58 |
# File 'lib/objectify/rails/routing.rb', line 56 def policy_responders() @application.objectify.append_policy_responders() end |
#resolvers(options) ⇒ Object
64 65 66 |
# File 'lib/objectify/rails/routing.rb', line 64 def resolvers() @application.objectify.append_resolvers() end |
#resources(*args) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/objectify/rails/routing.rb', line 20 def resources(*args) = args. = () controller = @application.objectify.objectify_controller = .merge(:controller => controller) args.each do |resource_name| objectify_defaults = {:resource => resource_name} merged_defaults = merge_defaults(objectify_defaults.merge(:append_action => true), ) @rails_mapper.resources(resource_name, merged_defaults) RESOURCE_ACTIONS.each do |action_name| append_action(objectify_defaults.merge(:action => action_name), resource_name, action_name, ) end end end |
#values(options) ⇒ Object
68 69 70 |
# File 'lib/objectify/rails/routing.rb', line 68 def values() @application.objectify.append_values() end |