lib/stack/parsable.rb in stack-0.0.3 vs lib/stack/parsable.rb in stack-0.0.4

- old
+ new

@@ -4,31 +4,25 @@ attr_accessor :data attr_accessor :inline_data def parse!(raw_doc = self.raw, defaults = { }) self.data, self.raw = extract_yaml(raw_doc, nil, defaults) - - puts self.data end def payload - self.data.deep_symbolize.merge(:inline_data => inline_data) + self.data.deep_symbolize.merge(:data => inline_data) end def extract_yaml(raw, replace = nil, defaults = { }) self.inline_data = [ ] data_table = defaults out = raw.dup i = -1 - puts "out -> #{out}" - while out =~ /^(---\s*\n.*?\n?)(---.*?\n)/m yaml = $1.dup - out = out.gsub(/#{Regexp.escape(yaml)}#{Regexp.escape($2)}/m,((i>-1) ? "{{ document.inline_data[#{i}] | render_table }}" : "")) - - puts "out2 -> #{out}" + out = out.gsub(/#{Regexp.escape(yaml)}#{Regexp.escape($2)}/m,((i>-1) ? "{{ document.data[#{i}] | render_table }}" : "")) d = YAML.load(yaml) if d.is_a?(Hash) self.inline_data << d if i > -1 \ No newline at end of file