Class: MetaRuby::GUI::ModelHierarchy::Resolver

Inherits:
Object
  • Object
show all
Defined in:
lib/metaruby/gui/model_hierarchy.rb

Instance Method Summary collapse

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