Module: Vedeu::Repositories::Model
- Includes:
- Common
- Included in:
- Borders::Border, Buffers::Buffer, Cursors::Cursor, Editor::Document, Events::Event, Geometry::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: ClassMethods
Instance Attribute Summary collapse
Class Method Summary collapse
-
.included(klass) ⇒ void
When this module is included in a class, provide ClassMethods as class methods for the class.
Instance Method Summary collapse
-
#absent?(variable) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether a variable is nil or empty.
-
#demodulize(klass) ⇒ String
included
from Common
private
Removes the module part from the expression in the string.
-
#present?(variable) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether a variable has a useful value.
-
#snake_case(name) ⇒ String
included
from Common
private
Converts a class name to a lowercase snake case string.
-
#store ⇒ void
The model instance stored in the repository.
Instance Attribute Details
#repository ⇒ Vedeu::Repositories::Repository
14 15 16 |
# File 'lib/vedeu/repositories/model.rb', line 14 def repository @repository end |
Class Method Details
.included(klass) ⇒ void
This method returns an undefined value.
When this module is included in a class, provide ClassMethods as class methods for the class.
86 87 88 |
# File 'lib/vedeu/repositories/model.rb', line 86 def self.included(klass) klass.send(:extend, ClassMethods) end |
Instance Method Details
#absent?(variable) ⇒ Boolean Originally defined in module Common
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a boolean indicating whether a variable is nil or empty.
#demodulize(klass) ⇒ String Originally defined in module Common
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Removes the module part from the expression in the string.
#present?(variable) ⇒ Boolean Originally defined in module Common
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a boolean indicating whether a variable has a useful value.
#snake_case(name) ⇒ String Originally defined in module Common
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Converts a class name to a lowercase snake case string.
#store ⇒ void
Perhaps some validation could be added here?
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.
94 95 96 97 98 99 100 |
# File 'lib/vedeu/repositories/model.rb', line 94 def store new_model = repository.store(self) yield if block_given? new_model end |