Sha256: 7799c281d69f1c4662f41f0d84d85bac374c6e59a462f2d7be95cd014f8c726a

Contents?: true

Size: 986 Bytes

Versions: 47

Compression:

Stored size: 986 Bytes

Contents

# HoboSupport - XSS helpers

    >> require 'active_support'
    >> $:.unshift File.join(File.expand_path(File.dirname(__FILE__)), '../../../hobo_support/lib')
    >> require 'hobo_support'

## safe_join

Version of Array#join that preserves html\_safe:

    >> $,=nil
    >> ["<a>", "<b>"].safe_join
    => "&lt;a&gt;&lt;b&gt;"

    >> ["<a>", "<b>"].safe_join.html_safe?
    => true

    >> ["<a>".html_safe, "<b>"].safe_join
    => "<a>&lt;b&gt;"

    >> ["<a>".html_safe, "<b>"].safe_join.html_safe?
    => true

    >> ["<a>".html_safe, "<b>".html_safe].safe_join
    => "<a><b>"

    >> ["<a>".html_safe, "<b>".html_safe].safe_join.html_safe?
    => true


    >> ["<a>", "<b>"].safe_join("<br>")
    => "&lt;a&gt;&lt;br&gt;&lt;b&gt;"

    >> ["<a>", "<b>"].safe_join("<br>").html_safe?
    => true

    >> ["<a>".html_safe, "<b>".html_safe].safe_join("<br>")
    => "<a>&lt;br&gt;<b>"

    >> ["<a>".html_safe, "<b>".html_safe].safe_join("<br>".html_safe)
    => "<a><br><b>"



Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
hobo_support-1.4.0.pre2 test/hobosupport/xss.rdoctest
hobo_support-1.3.0 test/hobosupport/xss.rdoctest
hobo_support-1.3.0.RC4 test/hobosupport/xss.rdoctest
hobo_support-1.3.0.RC3 test/hobosupport/xss.rdoctest
hobo_support-1.3.0.RC2 test/hobosupport/xss.rdoctest
hobo_support-1.3.0.RC1 test/hobosupport/xss.rdoctest
hobo_support-1.3.0.RC test/hobosupport/xss.rdoctest
hobo_support-1.3.0.pre31 test/hobosupport/xss.rdoctest
hobo_support-1.3.0.pre29 test/hobosupport/xss.rdoctest
hobo_support-1.3.0.pre28 test/hobosupport/xss.rdoctest
hobo_support-1.3.0.pre27 test/hobosupport/xss.rdoctest
hobo_support-1.3.0.pre26 test/hobosupport/xss.rdoctest
hobo_support-1.3.0.pre25 test/hobosupport/xss.rdoctest
hobo_support-1.3.0.pre24 test/hobosupport/xss.rdoctest
hobo_support-1.3.0.pre23 test/hobosupport/xss.rdoctest
hobo_support-1.3.0.pre22 test/hobosupport/xss.rdoctest
hobo_support-1.3.0.pre21 test/hobosupport/xss.rdoctest
hobo_support-1.3.0.pre20 test/hobosupport/xss.rdoctest
hobo_support-1.3.0.pre19 test/hobosupport/xss.rdoctest
hobo_support-1.3.0.pre18 test/hobosupport/xss.rdoctest