Sha256: fe91ae59bcb12943e43bbbdcd19ded805b01c0b7468af2b81b33681e185fc1c6
Contents?: true
Size: 643 Bytes
Versions: 2
Compression:
Stored size: 643 Bytes
Contents
require 'osheet/partial' module Osheet class Template < Partial # this class is a partial that is associated with an osheet element # if an element is initialized from a template, the template # block will be instance_eval'd for the element being initialized ELEMENTS = ['worksheet', 'column', 'row', 'cell'] attr_reader :element def initialize(element, name) unless element.respond_to?(:to_s) && ELEMENTS.include?(element.to_s) raise ArgumentError, "you can only define a template for #{ELEMENTS.join(', ')} elements." end @element = element.to_s super(name) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
osheet-1.1.1 | lib/osheet/template.rb |
osheet-1.1.0 | lib/osheet/template.rb |