class Escpos::Report

Attributes

options[R]

Public Class Methods

new(file_or_path, options = {}) click to toggle source
# File lib/escpos/report.rb, line 10
def initialize(file_or_path, options = {})
  @options = options
  if file_or_path.is_a?(String)
    @template = ERB.new(File.open(file_or_path).read)
  elsif file_or_path.is_a?(File)
    @template = ERB.new(file_or_path.read)
  else
    raise ArgumentError.new("Must pass instance of file or path as argument.")
  end
end

Public Instance Methods

render() click to toggle source
# File lib/escpos/report.rb, line 21
def render
  @template.result binding
end