class Clian::Config::List
Parse Array object in YAML
Public Class Methods
new(item_class, array = [])
click to toggle source
# File lib/clian/config.rb, line 149 def initialize(item_class, array = []) @original_hash = array @configs = [] (array || []).each do |value| item = item_class.new(value) @configs << item end end
Public Instance Methods
<<(conf)
click to toggle source
# File lib/clian/config.rb, line 164 def <<(conf) @configs << conf end
[](key)
click to toggle source
# File lib/clian/config.rb, line 158 def [](key) @configs.find {|c| c.name == key} end
Also aliased as: get_subnode
each() { |conf| ... }
click to toggle source
# File lib/clian/config.rb, line 172 def each @configs.each do |conf| yield conf end end
to_hash()
click to toggle source
# File lib/clian/config.rb, line 168 def to_hash # XXX: actually, it returns a Array return @configs.map {|c| c.respond_to?(:to_hash) ? c.to_hash : c.to_s} end