Class: Xumlidot::Diagram::Xmi::NamespaceToId
- Inherits:
-
Object
- Object
- Xumlidot::Diagram::Xmi::NamespaceToId
- Defined in:
- lib/xumlidot/diagram/xmi.rb
Overview
We need to keep track of the ids assigned in the body for each class.
Instance Method Summary collapse
- #[](name) ⇒ Object
- #[]=(name, id) ⇒ Object
- #has?(full_namespace) ⇒ Boolean
-
#has_value?(id) ⇒ Boolean
reverse lookup.
-
#initialize ⇒ NamespaceToId
constructor
A new instance of NamespaceToId.
Constructor Details
#initialize ⇒ NamespaceToId
Returns a new instance of NamespaceToId.
69 70 71 72 |
# File 'lib/xumlidot/diagram/xmi.rb', line 69 def initialize @namespace_to_id = {} @id_to_namespace = {} end |
Instance Method Details
#[](name) ⇒ Object
83 84 85 |
# File 'lib/xumlidot/diagram/xmi.rb', line 83 def [](name) @namespace_to_id[name] end |
#[]=(name, id) ⇒ Object
87 88 89 90 |
# File 'lib/xumlidot/diagram/xmi.rb', line 87 def []=(name, id) @namespace_to_id[name] = id @id_to_namespace[id] = name end |
#has?(full_namespace) ⇒ Boolean
79 80 81 |
# File 'lib/xumlidot/diagram/xmi.rb', line 79 def has?(full_namespace) @namespace_to_id[full_namespace] != nil end |
#has_value?(id) ⇒ Boolean
reverse lookup
75 76 77 |
# File 'lib/xumlidot/diagram/xmi.rb', line 75 def has_value?(id) # rubocop:disable Naming/PredicateName @id_to_namespace[id] != nil end |