Module: Vedeu::Model
- Includes:
- Common
- Included in:
- Borders::Border, Buffers::Buffer, Cursors::Cursor, Editor::Document, Events::Event, Geometry::Geometry, Input::Keymap, Vedeu::Menus::Menu, Vedeu::Models::Group, Vedeu::Models::Interface, 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
-
#deputy(client = nil) ⇒ void
Returns a DSL instance responsible for defining the DSL methods of this model.
-
#dsl_class ⇒ String
private
Returns the DSL class name responsible for this model.
-
#store ⇒ void
The model instance stored in the repository.
Methods included from Common
#demodulize, #present?, #snake_case
Instance Attribute Details
#repository ⇒ Vedeu::Repository
12 13 14 |
# File 'lib/vedeu/repositories/model.rb', line 12 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
#deputy(client = nil) ⇒ void
This method returns an undefined value.
Returns a DSL instance responsible for defining the DSL methods of this model.
98 99 100 |
# File 'lib/vedeu/repositories/model.rb', line 98 def deputy(client = nil) Object.const_get(dsl_class).new(self, client) end |
#dsl_class ⇒ String (private)
Returns the DSL class name responsible for this model.
113 114 115 116 117 118 119 120 121 122 |
# File 'lib/vedeu/repositories/model.rb', line 113 def dsl_class case demodulize(self.class.name) when 'Border' then 'Vedeu::Borders::DSL' when 'Buffer' then 'Vedeu::Buffers::DSL' when 'Geometry' then 'Vedeu::Geometry::DSL' when 'Menu' then 'Vedeu::Menus::DSL' else 'Vedeu::DSL::' + demodulize(self.class.name) end end |
#store ⇒ void
Perhaps some validation could be added here?
This method returns an undefined value.
Returns The model instance stored in the repository.
104 105 106 |
# File 'lib/vedeu/repositories/model.rb', line 104 def store repository.store(self) # if valid? end |