Class: BinPacking::Export

Inherits:
Object
  • Object
show all
Defined in:
lib/bin_packing/export.rb

Instance Method Summary collapse

Constructor Details

#initialize(*bins) ⇒ Export

Returns a new instance of Export.



3
4
5
# File 'lib/bin_packing/export.rb', line 3

def initialize(*bins)
  @bins = Array(bins).flatten
end

Instance Method Details

#to_html(options = {}) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/bin_packing/export.rb', line 7

def to_html(options = {})
  template_path = File.expand_path('../resources/export.html.erb', __FILE__)
  template = File.read(template_path)
  binding = ExportBinding.new(@bins, options[:zoom] || 1)
  html = ERB.new(template).result(binding.get_binding)
  html
end