Sha256: f9c124c4849f65b5b7839db3e64f64489b217fbd8904212bb921521a4c2970c6

Contents?: true

Size: 681 Bytes

Versions: 6

Compression:

Stored size: 681 Bytes

Contents

module Garterbelt
  class ContentTag < ClosedTag
    include ContentRendering
    
    def initialize(opts, &block)
      super
      if block_given?
        self.content = block
      else
        self.content = opts[:content]
      end
    end
    
    def id(identifier, &block)
      super(identifier)
      self.content = block if block_given?
      self
    end
    
    def c(*classes, &block)
      super(*classes)
      self.content = block if block_given?
      self
    end
    
    def head
      self.output << "#{indent}<#{type}#{rendered_attributes}>\n"
      super
    end
    
    def foot
      super
      self.output << "#{indent}</#{type}>\n"
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
garterbelt-0.0.7 lib/renderers/content_tag.rb
garterbelt-0.0.6 lib/renderers/content_tag.rb
garterbelt-0.0.5 lib/renderers/content_tag.rb
garterbelt-0.0.4 lib/renderers/content_tag.rb
garterbelt-0.0.3 lib/renderers/content_tag.rb
garterbelt-0.0.2 lib/renderers/content_tag.rb