Class: Pool
- Inherits:
-
Object
- Object
- Pool
- Defined in:
- lib/pkm_level2_converter/pools.rb
Overview
Generische Pool-Klasse
Direct Known Subclasses
AusgangskontextPool, AusgangsparameterPool, AusgangsschnittstellenPool, SprachePool
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Class Method Summary collapse
-
.parse_pool(xml_node, path_of_pool, type_of_pool) ⇒ Object
MOVED TO PKM-Class.
Instance Method Summary collapse
- #empty? ⇒ Boolean
- #get_by_reference(key) ⇒ Object
-
#initialize(xml_node, type) ⇒ Pool
constructor
A new instance of Pool.
- #length ⇒ Object
Constructor Details
#initialize(xml_node, type) ⇒ Pool
Returns a new instance of Pool.
14 15 16 17 18 19 |
# File 'lib/pkm_level2_converter/pools.rb', line 14 def initialize(xml_node, type) @type = type @key = xml_node['key'].to_i children = xml_node.children @items = children.map.with_index { |parameter, index| type.new(parameter, @key, index) } end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
21 22 23 |
# File 'lib/pkm_level2_converter/pools.rb', line 21 def items @items end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
21 22 23 |
# File 'lib/pkm_level2_converter/pools.rb', line 21 def key @key end |
Class Method Details
.parse_pool(xml_node, path_of_pool, type_of_pool) ⇒ Object
MOVED TO PKM-Class
8 9 10 11 12 |
# File 'lib/pkm_level2_converter/pools.rb', line 8 def self.parse_pool(xml_node, path_of_pool, type_of_pool) # pool = @@pools[poolSymbol] node = xml_node.at_xpath(path_of_pool) type_of_pool.new(node) end |
Instance Method Details
#empty? ⇒ Boolean
27 28 29 |
# File 'lib/pkm_level2_converter/pools.rb', line 27 def empty? (@items.nil? || @items.empty?) end |
#get_by_reference(key) ⇒ Object
23 24 25 |
# File 'lib/pkm_level2_converter/pools.rb', line 23 def get_by_reference(key) @items.find { |item| item.key == key } end |
#length ⇒ Object
31 32 33 |
# File 'lib/pkm_level2_converter/pools.rb', line 31 def length @items.length end |