3
0

Sections in a separate class attribute.

This commit is contained in:
Philippe PITTOLI 2019-08-08 11:24:42 +02:00
parent f41db48681
commit 806f73fe4e

View File

@ -76,11 +76,12 @@ class Specs
end
property assignments : Hash(String, StringContainer | LongStringContainer | Array(Section) | ArrayContainer)
property assignments : Hash(String, StringContainer | LongStringContainer | ArrayContainer)
property sections : Array(Section)
def initialize
@assignments = Hash(String, StringContainer | LongStringContainer | Array(Section) | ArrayContainer).new
@assignments["sections"] = Array(Section).new
@assignments = Hash(String, StringContainer | LongStringContainer | ArrayContainer).new
@sections = Array(Section).new
end
def parse_assignment (line : String)
@ -236,11 +237,8 @@ class Specs
end
end
sections = @assignments["sections"]
if sections.is_a?(Array(Section))
sections.push section
end
end
def parse_lines(content : Array(String))
count = 0
@ -366,13 +364,13 @@ class Specs
replace_string_obj v
when ArrayContainer
replace_array_obj v
when Array(Section)
v.each do |section|
end
end
sections.each do |section|
replace_section_obj section
end
end
end
end
# The only function to use from outside.