Sha256: 1b2f520f8dd5c948284dace864ab702892e356855f7580249d5b3644d841d8d3

Contents?: true

Size: 540 Bytes

Versions: 2

Compression:

Stored size: 540 Bytes

Contents

module Hotcell
  class Tag < Hotcell::Node
    attr_reader :mode

    def initialize *_
      super
      @mode = options[:mode] || :normal
    end

    def process context, *values
      values.last
    end

    def render context
      context.safe do
        concat context, process(context, *render_children(context))
      end
    end

    def concat context, result
      case mode
      when :silence
        ''
      when :escape
        ERB::Util.html_escape_once(result)
      else
        result.to_s
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hotcell-0.3.0 lib/hotcell/node/tag.rb
hotcell-0.2.0 lib/hotcell/node/tag.rb