Module: Vedeu::Model
- Included in:
- Border, Buffer, Composition, Cursor, Event, Geometry, Group, Interface, Keymap, Line, Menu, Stream
- Defined in:
- lib/vedeu/models/model.rb,
lib/vedeu/models/collection.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 Classes: Collection
Instance Attribute Summary collapse
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
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 ⇒ Object (readonly)
Returns the value of attribute repository.
8 9 10 |
# File 'lib/vedeu/models/model.rb', line 8 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.
60 61 62 |
# File 'lib/vedeu/models/model.rb', line 60 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.
91 92 93 94 95 |
# File 'lib/vedeu/models/model.rb', line 91 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.
72 73 74 |
# File 'lib/vedeu/models/model.rb', line 72 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.
100 101 102 |
# File 'lib/vedeu/models/model.rb', line 100 def dsl_class 'Vedeu::DSL::' + demodulize(self.class.name) end |
#store ⇒ void
Perhaps some validation could be added here?
This method returns an undefined value.
Returns The model instance stored in the repository.
78 79 80 |
# File 'lib/vedeu/models/model.rb', line 78 def store repository.store(self) # if valid? end |