Class: Config::ComplexUnit
- Inherits:
-
ComplexItem
- Object
- Item
- ComplexItem
- Config::ComplexUnit
- Defined in:
- lib/module_config/items/complexunit.rb
Constant Summary collapse
- @@subitemregex =
/\A(([\w\/]+,\s*)*[\w\/]+)\s*\((.+)\)\Z/
Instance Attribute Summary
Attributes inherited from ComplexItem
Attributes inherited from Item
Instance Method Summary collapse
-
#initialize(_str, _regex) ⇒ ComplexUnit
constructor
A new instance of ComplexUnit.
- #print ⇒ Object
Methods inherited from ComplexItem
Methods inherited from Item
Constructor Details
#initialize(_str, _regex) ⇒ ComplexUnit
Returns a new instance of ComplexUnit.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/module_config/items/complexunit.rb', line 24 def initialize(_str, _regex) super(_str, _regex) tmp = @value @value = [] tmp.each do |item| item.strip! if item =~ @@subitemregex item = Hash.new item["deppath"] = $1 item["archs"] = $3.split(/,\s*/) item["deppath"] = item["deppath"].split(/,\s*/) @value.push(item) else raise ConfigWrongFormatException.new(self.class), "Configuration subitem <#{item}> of item <#{name}> has wrong format." end end end |
Instance Method Details
#print ⇒ Object
44 45 46 47 48 |
# File 'lib/module_config/items/complexunit.rb', line 44 def print puts " #{@name} = { ##{self.class.to_s}" @value.each { |v| puts " #{v["deppath"].join(", ")}(#{v["archs"].join(", ")});" } puts " }" end |