Class: MetaRuby::GUI::ModelHierarchy::Resolver
- Inherits:
-
Object
- Object
- MetaRuby::GUI::ModelHierarchy::Resolver
- Defined in:
- lib/metaruby/gui/model_hierarchy.rb
Instance Method Summary collapse
- #each_submodel(model) ⇒ Object
-
#initialize(root_model) ⇒ Resolver
constructor
A new instance of Resolver.
- #split_name(model) ⇒ Object
Constructor Details
#initialize(root_model) ⇒ Resolver
Returns a new instance of Resolver.
27 28 29 |
# File 'lib/metaruby/gui/model_hierarchy.rb', line 27 def initialize(root_model) @root_model = root_model end |
Instance Method Details
#each_submodel(model) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/metaruby/gui/model_hierarchy.rb', line 40 def each_submodel(model) if model == @root_model model.each_submodel do |m| yield(m, !m.name) end end end |
#split_name(model) ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/metaruby/gui/model_hierarchy.rb', line 31 def split_name(model) name = model.name split = model.name.split('::') if name.start_with?('::') split[1..-1] else split end end |