Module: ObjectPaths::ModelSupport
- Defined in:
- lib/object_paths/model_support.rb
Overview
Adds convenience & helper methods to to models, classes and modules to ease the creation, use and resolution of ObjectPaths.
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
-
#object_path(path_definition) ⇒ ObjectPaths::ObjectPath
Adds a convenience method to the object level for creating ObjectPaths.
-
#object_path!(path_definition) ⇒ Object?
Resolves the ObjectPath against the current object.
Class Method Details
.included(base) ⇒ Object
9 10 11 |
# File 'lib/object_paths/model_support.rb', line 9 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#object_path(path_definition) ⇒ ObjectPaths::ObjectPath
Adds a convenience method to the object level for creating ObjectPaths.
17 18 19 |
# File 'lib/object_paths/model_support.rb', line 17 def object_path(path_definition) ObjectPaths::ObjectPath.new(path_definition) end |
#object_path!(path_definition) ⇒ Object?
Resolves the ObjectPath against the current object.
25 26 27 |
# File 'lib/object_paths/model_support.rb', line 25 def object_path!(path_definition) object_path(path_definition)&.resolve(self) end |