Module: Vedeu::Model
- Included in:
- Border, Buffer, Composition, Cursor, Event, Geometry, Group, Interface, Keymap, Line, Menu, Stream
- 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
-
#demodulize(klass) ⇒ void
private
Removes the module part from the expression in the string.
-
#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.
Instance Attribute Details
#repository ⇒ Vedeu::Repository
9 10 11 |
# File 'lib/vedeu/repositories/model.rb', line 9 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.
72 73 74 |
# File 'lib/vedeu/repositories/model.rb', line 72 def self.included(klass) klass.send :extend, ClassMethods end |
Instance Method Details
#demodulize(klass) ⇒ void (private)
This method returns an undefined value.
Removes the module part from the expression in the string.
103 104 105 106 107 |
# File 'lib/vedeu/repositories/model.rb', line 103 def demodulize(klass) klass = klass.to_s klass[(klass.rindex('::') + 2)..-1] end |
#deputy(client = nil) ⇒ void
This method returns an undefined value.
Returns a DSL instance responsible for defining the DSL methods of this model.
84 85 86 |
# File 'lib/vedeu/repositories/model.rb', line 84 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.
112 113 114 |
# File 'lib/vedeu/repositories/model.rb', line 112 def dsl_class 'Vedeu::DSL::' + demodulize(self.class.name) end |
#store ⇒ void
90 91 92 |
# File 'lib/vedeu/repositories/model.rb', line 90 def store repository.store(self) # if valid? end |