class UserPlane::RouteConcerns::AbstractConcern
Attributes
concern_options[RW]
mapper[RW]
Public Class Methods
new(options = {})
click to toggle source
# File lib/user_plane/route_concerns.rb, line 14 def initialize(options = {}) defaults = RouteConcerns::DEFAULTS.merge(options) @namespace = defaults[:namespace] @defaults = defaults.except(:namespace) end
Public Instance Methods
call(mapper, concern_options = {})
click to toggle source
The abstract concern should be able to handle resources having a preferred collection/resource target.
# File lib/user_plane/route_concerns.rb, line 27 def call(mapper, concern_options = {}) @mapper = mapper @concern_options = concern_options build end
exists?(concern)
click to toggle source
Returns true if a particular concern exists
# File lib/user_plane/route_concerns.rb, line 21 def exists? concern mapper.instance_variable_get('@concerns').include?(concern) end
options(custom_route_options={})
click to toggle source
# File lib/user_plane/route_concerns.rb, line 34 def options custom_route_options={} resource_scope = mapper.send :resource_scope? if resource_scope @defaults.merge(@concern_options).merge(custom_route_options) else @defaults.merge(@concern_options).merge(custom_route_options).except(:on) end end