Sha256: 78981587ca4411d10febc7828e68d052fbaff012dcd8b6dbe1f05ab1073f2080

Contents?: true

Size: 537 Bytes

Versions: 13

Compression:

Stored size: 537 Bytes

Contents

class String
  def c(*codes)
    "\e[#{codes.join;}m#{self}\e[0m"
  end

  def u
    gsub(/&(lt|gt|amp|quot|apos);/) do |s|
      case s
        when '&' then '&'
        when '&lt;' then '<'
        when '&gt;' then '>'
        when '&apos;' then "'"
        when '&quot;' then '"'
      end
    end
  end

  def e
    gsub(/[&<>'"]/) do |s|
      case s
        when '&' then '&amp;'
        when '<' then '&lt;'
        when '>' then '&gt;'
        when "'" then '&apos;'
        when '"' then '&quot;'
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
earthquake-0.5.7 lib/earthquake/ext.rb
earthquake-0.5.6 lib/earthquake/ext.rb
earthquake-0.5.5 lib/earthquake/ext.rb
earthquake-0.5.4 lib/earthquake/ext.rb
earthquake-0.5.3 lib/earthquake/ext.rb
earthquake-0.5.2 lib/earthquake/ext.rb
earthquake-0.5.1 lib/earthquake/ext.rb
earthquake-0.5.0 lib/earthquake/ext.rb
earthquake-0.4.9 lib/earthquake/ext.rb
earthquake-0.4.8 lib/earthquake/ext.rb
earthquake-0.4.7 lib/earthquake/ext.rb
earthquake-0.4.6 lib/earthquake/ext.rb
earthquake-0.4.5 lib/earthquake/ext.rb