Sha256: 01cd70119d19b709965a3618c34a0223b827ce2df145966d34e5ec4550ceaec5

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

module Lablr
  module Template # templates define label layout(with erb) and rendering
    class Base
      attr_accessor :erb, :name, :content, :style
      #@erb_template = nil
      #@name = nil
      
      def initialize(options = {})
        #@erb = options[:erb]          ||= nil
        options[:name]    ||= "avery_5163"
        options[:content] ||= "No Content Set"
        options[:style]   ||= TemplateStyle.new
        
        @name                 = options[:name]              
        @content              = options[:content]          
        @style                = options[:style] 
        
        template_file = File.join(Lablr.GEM_ROOT, "assets", "templates",  "_" + (@name.to_s) + ".erb")
        template_content = File.exists?(template_file) ? File.read(template_file) : "Template Not Found: #{template_file}"
        
        @erb = ::ERB.new(template_content)
      end
         
      def getBinding # make binding accessible to pass into erb
        return binding
      end         
    end
    
    
    class Avery5163     
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lablr-0.2.0 lib/lablr/template.rb
lablr-0.1.2 lib/lablr/template.rb