Sha256: 15159e1e00e756729efe44c3b26255e2c14a4e06a48f3113dc8a24d45b1258e8

Contents?: true

Size: 429 Bytes

Versions: 6

Compression:

Stored size: 429 Bytes

Contents

module Flannel
  module Wrappable
    def wrap content, tag, element_id=nil
      if empty_string?(content) || empty_string?(tag)
        return content
      end

      content.strip! unless tag == "pre"

      if element_id
        "<#{tag} id='#{element_id}'>#{content}</#{tag}>"
      else
        "<#{tag}>#{content}</#{tag}>"
      end
    end

    def empty_string? str
      str.nil? || str.strip == ""
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
flannel-0.2.14 lib/flannel/wrappable.rb
flannel-0.2.13 lib/flannel/wrappable.rb
flannel-0.2.12 lib/flannel/wrappable.rb
flannel-0.2.11 lib/flannel/wrappable.rb
flannel-0.2.10 lib/flannel/wrappable.rb
flannel-0.2.9 lib/flannel/wrappable.rb