Class: Concrete::HamlEvalContext
- Inherits:
-
Object
- Object
- Concrete::HamlEvalContext
- Defined in:
- lib/concrete/haml_eval_context.rb
Overview
Objects of this class are meant to be used as HAML eval context Context methods provide convenient access to the metamodel The metamodel is expected to be a RGen ECore metamodel
Instance Method Summary collapse
-
#initialize(mm) ⇒ HamlEvalContext
constructor
A new instance of HamlEvalContext.
- #metaclass(name) ⇒ Object
- #metaclassAttributes(name, options = {}) ⇒ Object
- #metaclassContainments(name, options = {}) ⇒ Object
- #metaclasses ⇒ Object
- #metaclassFeatures(name, options = {}) ⇒ Object
- #metaclassReferences(name, options = {}) ⇒ Object
Constructor Details
#initialize(mm) ⇒ HamlEvalContext
Returns a new instance of HamlEvalContext.
9 10 11 12 |
# File 'lib/concrete/haml_eval_context.rb', line 9 def initialize(mm) @mm = mm = nil end |
Instance Method Details
#metaclass(name) ⇒ Object
19 20 21 22 |
# File 'lib/concrete/haml_eval_context.rb', line 19 def (name) loadMetaclasses unless [name] end |
#metaclassAttributes(name, options = {}) ⇒ Object
41 42 43 |
# File 'lib/concrete/haml_eval_context.rb', line 41 def (name, ={}) (name, ).select{|f| f.is_a?(RGen::ECore::EAttribute)} end |
#metaclassContainments(name, options = {}) ⇒ Object
33 34 35 |
# File 'lib/concrete/haml_eval_context.rb', line 33 def (name, ={}) (name, ).select{|f| f.is_a?(RGen::ECore::EReference) && f.containment} end |
#metaclasses ⇒ Object
14 15 16 17 |
# File 'lib/concrete/haml_eval_context.rb', line 14 def loadMetaclasses unless .values end |
#metaclassFeatures(name, options = {}) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/concrete/haml_eval_context.rb', line 24 def (name, ={}) exclusions = [:except] || [] if exclusions.is_a?(Array) (name).eAllStructuralFeatures.reject{|f| exclusions.include?(f.name)} else (name).eAllStructuralFeatures.reject{|f| exclusions == f.name} end end |
#metaclassReferences(name, options = {}) ⇒ Object
37 38 39 |
# File 'lib/concrete/haml_eval_context.rb', line 37 def (name, ={}) (name, ).select{|f| f.is_a?(RGen::ECore::EReference) && !f.containment} end |