Class: Sevgi::Graphics::Mixtures::Identify::Identifiers
- Inherits:
-
Object
- Object
- Sevgi::Graphics::Mixtures::Identify::Identifiers
- Defined in:
- lib/sevgi/graphics/mixtures/identify.rb
Overview
Index of element ids under a subtree.
Instance Attribute Summary collapse
-
#collision ⇒ Hash<String, Array<Sevgi::Graphics::Element>>
readonly
Duplicate id groups.
-
#element ⇒ Sevgi::Graphics::Element
readonly
Indexed root element.
-
#namespace ⇒ Hash<String, Sevgi::Graphics::Element>
readonly
Id namespace.
Instance Method Summary collapse
-
#[](id) ⇒ Sevgi::Graphics::Element?
Returns the element registered for an id.
-
#conflict? ⇒ Boolean
Reports whether duplicate ids were found.
-
#initialize(element) ⇒ void
constructor
Builds an id index for an element subtree.
Constructor Details
#initialize(element) ⇒ void
Builds an id index for an element subtree.
22 23 24 25 26 27 28 |
# File 'lib/sevgi/graphics/mixtures/identify.rb', line 22 def initialize(element) @element = element @namespace = {} @collision = {} build end |
Instance Attribute Details
#collision ⇒ Hash<String, Array<Sevgi::Graphics::Element>> (readonly)
Returns duplicate id groups.
17 18 19 |
# File 'lib/sevgi/graphics/mixtures/identify.rb', line 17 def collision @collision end |
#element ⇒ Sevgi::Graphics::Element (readonly)
Returns indexed root element.
11 12 13 |
# File 'lib/sevgi/graphics/mixtures/identify.rb', line 11 def element @element end |
#namespace ⇒ Hash<String, Sevgi::Graphics::Element> (readonly)
Returns id namespace.
14 15 16 |
# File 'lib/sevgi/graphics/mixtures/identify.rb', line 14 def namespace @namespace end |
Instance Method Details
#[](id) ⇒ Sevgi::Graphics::Element?
40 41 42 |
# File 'lib/sevgi/graphics/mixtures/identify.rb', line 40 def [](*) @namespace[*] end |
#conflict? ⇒ Boolean
Reports whether duplicate ids were found.
32 33 34 |
# File 'lib/sevgi/graphics/mixtures/identify.rb', line 32 def conflict? !@collision.empty? end |