Sections in a separate class attribute.
This commit is contained in:
parent
f41db48681
commit
806f73fe4e
20
src/spec.cr
20
src/spec.cr
@ -76,11 +76,12 @@ class Specs
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
property assignments : Hash(String, StringContainer | LongStringContainer | Array(Section) | ArrayContainer)
|
property assignments : Hash(String, StringContainer | LongStringContainer | ArrayContainer)
|
||||||
|
property sections : Array(Section)
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@assignments = Hash(String, StringContainer | LongStringContainer | Array(Section) | ArrayContainer).new
|
@assignments = Hash(String, StringContainer | LongStringContainer | ArrayContainer).new
|
||||||
@assignments["sections"] = Array(Section).new
|
@sections = Array(Section).new
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_assignment (line : String)
|
def parse_assignment (line : String)
|
||||||
@ -236,10 +237,7 @@ class Specs
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
sections = @assignments["sections"]
|
sections.push section
|
||||||
if sections.is_a?(Array(Section))
|
|
||||||
sections.push section
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_lines(content : Array(String))
|
def parse_lines(content : Array(String))
|
||||||
@ -366,12 +364,12 @@ class Specs
|
|||||||
replace_string_obj v
|
replace_string_obj v
|
||||||
when ArrayContainer
|
when ArrayContainer
|
||||||
replace_array_obj v
|
replace_array_obj v
|
||||||
when Array(Section)
|
|
||||||
v.each do |section|
|
|
||||||
replace_section_obj section
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sections.each do |section|
|
||||||
|
replace_section_obj section
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user