Class: MigrationHistory::Formatter::HtmlFormatter

Inherits:
Base
  • Object
show all
Defined in:
lib/migration_history/formatter/html_formatter.rb

Constant Summary

Constants inherited from Base

Base::DEFAULT_OUTPUT_FILE_NAME

Instance Attribute Summary

Attributes inherited from Base

#output_file_name

Instance Method Summary collapse

Methods inherited from Base

#initialize, #output_file_name_with_extension

Constructor Details

This class inherits a constructor from MigrationHistory::Formatter::Base

Instance Method Details

#file_extensionObject



18
19
20
# File 'lib/migration_history/formatter/html_formatter.rb', line 18

def file_extension
  "html"
end

#format(result_set) ⇒ Object



8
9
10
11
12
# File 'lib/migration_history/formatter/html_formatter.rb', line 8

def format(result_set)
  File.open(File.join(Dir.pwd, output_file_name_with_extension), "wb") do |file|
    file.puts template("template").result(binding)
  end
end

#template(name) ⇒ Object



14
15
16
# File 'lib/migration_history/formatter/html_formatter.rb', line 14

def template(name)
  ERB.new(File.read(File.join(File.dirname(__FILE__), "../../../views/", "#{name}.erb")))
end