Module: Vedeu::Repositories::Model
- Includes:
- Common
- Included in:
- Borders::Border, Buffers::Buffer, Cursors::Cursor, Editor::Document, Events::Event, Geometries::Geometry, Groups::Group, Input::Keymap, Interfaces::Interface, Menus::Menu, Views::Composition, Views::Line, Views::Stream, Views::View
- Defined in:
- lib/vedeu/repositories/model.rb
Overview
When included into a class, provides the mechanism to store the class in a repository for later retrieval.
Defined Under Namespace
Modules: SingletonMethods
Instance Attribute Summary collapse
Class Method Summary collapse
-
.included(klass) ⇒ Class
Provide additional behaviour to a class or module.
Instance Method Summary collapse
-
#store(&block) ⇒ void
The model instance stored in the repository.
Methods included from Common
#absent?, #array?, #boolean, #boolean?, #empty_value?, #escape?, #falsy?, #hash?, #line_model?, #numeric?, #positionable?, #present?, #snake_case, #stream_model?, #string?, #symbol?, #truthy?, #view_model?
Instance Attribute Details
#repository ⇒ Vedeu::Repositories::Repository
17 18 19 |
# File 'lib/vedeu/repositories/model.rb', line 17 def repository @repository end |
Class Method Details
.included(klass) ⇒ Class
Provide additional behaviour to a class or module.
69 70 71 |
# File 'lib/vedeu/repositories/model.rb', line 69 def self.included(klass) klass.extend(Vedeu::Repositories::Model::SingletonMethods) end |
Instance Method Details
#store(&block) ⇒ void
TODO:
Perhaps some validation could be added here?
Note:
If a block is given, store the model, return the model after yielding.
This method returns an undefined value.
Returns The model instance stored in the repository.
77 78 79 |
# File 'lib/vedeu/repositories/model.rb', line 77 def store(&block) repository.store(self, &block) end |