Class: Redmine::Acts::Attachable::ObjectTypeConstraint
- Inherits:
-
Object
- Object
- Redmine::Acts::Attachable::ObjectTypeConstraint
- Defined in:
- lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb
Class Method Summary collapse
Class Method Details
.matches?(request) ⇒ Boolean
32 33 34 |
# File 'lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb', line 32 def matches?(request) request.path_parameters[:object_type] =~ param_expression end |
.param_expression ⇒ Object
41 42 43 |
# File 'lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb', line 41 def param_expression @param_expression ||= Regexp.new("^(#{object_types.to_a.join("|")})$") end |
.register_object_type(type) ⇒ Object
36 37 38 39 |
# File 'lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb', line 36 def register_object_type(type) object_types << type @param_expression = nil end |