Class: MetaRuby::GUI::ModelHierarchy::Metadata

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#categoriesObject

Returns the value of attribute categories

Returns:

  • (Object)

    the current value of categories



4
5
6
# File 'lib/metaruby/gui/model_hierarchy.rb', line 4

def categories
  @categories
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



4
5
6
# File 'lib/metaruby/gui/model_hierarchy.rb', line 4

def name
  @name
end

#search_keyObject

Returns the value of attribute search_key

Returns:

  • (Object)

    the current value of search_key



4
5
6
# File 'lib/metaruby/gui/model_hierarchy.rb', line 4

def search_key
  @search_key
end

Instance Method Details

#merge(other) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/metaruby/gui/model_hierarchy.rb', line 5

def merge(other)
    a, b = search_key, other.search_key.dup
    if a.size < b.size
        a, b = b, a
    end
    b.size.times do |i|
        a[i] |= b[i]
    end
    self.search_key = a
    self.categories = categories | other.categories
end

#to_user_roleObject



17
18
19
20
21
22
23
# File 'lib/metaruby/gui/model_hierarchy.rb', line 17

def to_user_role
    categories = self.categories.to_a.join(",")
    search_key = self.search_key.map do |level_keys|
        level_keys.join(",")
    end.join(",;,")
    ",#{categories},;,#{search_key},"
end