Method: Flannel::BaseBlock#create_from_list

Defined in:
lib/flannel/base_block.rb

#create_from_list(list) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/flannel/base_block.rb', line 21

def create_from_list list
  header = list.shift
  @type = header.shift[1]
  @id = header.shift[1]
  @attributes = {}

  next_item = header.shift
  while next_item
    case next_item[0]
    when :parent_id then
      @parent_id = next_item[1]
    when :attribute_list then
      next_item.shift
      next_item.each do |attribute|
        @attributes[attribute[0]] = attribute[1]
      end
    end
    next_item = header.shift
  end

  @text = list.shift
end