Sha256: c1e764a364fea895dfdb00265c6ab94dd2b58b3b1bdbcce873120575e2323871

Contents?: true

Size: 582 Bytes

Versions: 1

Compression:

Stored size: 582 Bytes

Contents

require 'template'

class Template
  class OutputBuffer
    def buffer
      self
    end

    alias << append

    # allow tags in haml to have dynamic attributes
    def attributes(class_id, obj_ref, *attributes_hashes)
      attributes = class_id

      attributes_hashes.each do |hash|
        attributes.update hash
      end

      result = attributes.collect do |attr, value|
        if value == true
          next " #{attr}"
        elsif value == false
          next
        else
          " #{attr}='#{value}'"
        end
      end

      result.join
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opal-haml-0.2.0 opal/opal-haml.rb