Sha256: 59b50e00c4721b259af1c58bda12c275d42e69eb8a371fb62e17ae5564774432

Contents?: true

Size: 764 Bytes

Versions: 1

Compression:

Stored size: 764 Bytes

Contents

# coding: utf-8

require 'erb'

module ThinReports
  module Generator
    
    # @private
    module Pxd::Helper
    private
      
      def content_tag(tag_name, content = nil, attrs = nil, options = {})
        content = h(content) unless options[:escape] == false
        tag(tag_name, attrs, true) << content.to_s << "</#{h(tag_name)}>"
      end
      
      def tag(tag_name, attrs = nil, open = false)
        attrs = tag_attributes(attrs)
        attrs = ' ' + attrs unless attrs.blank?
        "<#{h(tag_name)}#{attrs}#{open ? '' : ' /'}>"
      end
      
      def tag_attributes(attrs)
        attrs && attrs.map{|k, v| "#{h(k)}=\"#{h(v)}\"" }.join(' ')
      end
      
      def h(s)
        ERB::Util.html_escape(s)
      end
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
thinreports-0.6.0.pre3 lib/thinreports/generator/pxd/helper.rb