Class: RowHTML

Inherits:
HTML
  • Object
show all
Defined in:
lib/html_compilation/classes/builders/row_html.rb

Instance Attribute Summary

Attributes inherited from HTML

#data_location, #object

Instance Method Summary collapse

Methods inherited from HTML

#htmlify, #initialize

Methods included from YAMLInteraction

#key_value_add, #read_yaml

Constructor Details

This class inherits a constructor from HTML

Instance Method Details

#buildObject



2
3
4
5
6
7
8
9
10
11
# File 'lib/html_compilation/classes/builders/row_html.rb', line 2

def build
  self.send("data_location=", File.expand_path("../../../data/html_data/row_data.yaml", __FILE__))
  row = read_yaml(data_location, "TR")
  data_cell = read_yaml(data_location, "TD")
  cells = object.values.map do |key|
    data_cell.gsub("sample", (htmlify(object.send(key)).to_s))
  end
  cells.push(data_cell.gsub("sample", htmlify(object.instances.to_i.to_s)))
  row.gsub("sample", cells.join.to_s)
end