Sha256: 20f16cc43177667bf20afabdfd8cf5282c1343661ac41df48948fb5649d2964a

Contents?: true

Size: 484 Bytes

Versions: 21

Compression:

Stored size: 484 Bytes

Contents

# frozen_string_literal: true

module UiBibz::Ui::Concerns::HtmlConcern #:nodoc:
  extend ActiveSupport::Concern

  included do
    def html(content = nil, &block)
      if block.nil?
        @items << RenderString.new(content)
      else
        context = eval('self', block.binding) # rubocop:disable Style/EvalWithLocation
        @items << RenderString.new(context.capture(&block))
      end
    end
  end
end

class RenderString < SimpleDelegator
  def render
    self
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
ui_bibz-3.0.0.alpha12 lib/ui_bibz/ui/concerns/html_concern.rb