Sha256: b0f769d6b45f104d3d8025dc66a04c6c789a7670b92e924cd851a34c5542adcf

Contents?: true

Size: 915 Bytes

Versions: 22

Compression:

Stored size: 915 Bytes

Contents

# frozen_string_literal: true

module Plutonium
  module UI
    module Component
      module Behaviour
        extend ActiveSupport::Concern
        include Methods
        include Kit

        if Rails.env.development?
          def around_template(&)
            comment { "open:#{self.class.name}" }
            super
            comment { "close:#{self.class.name}" }
          end
        end

        protected

        def phlexi_render(arg, &)
          return unless arg
          raise ArgumentError, "phlexi_render requires a default render block" unless block_given?

          # Handle Phlex components or Rails Renderables
          if arg.class < Phlex::SGML || arg.respond_to?(:render_in)
            render arg
          # Handle procs
          elsif arg.respond_to?(:to_proc)
            instance_exec(&arg)
          else
            yield
          end
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
plutonium-0.15.18 lib/plutonium/ui/component/behaviour.rb
plutonium-0.15.17 lib/plutonium/ui/component/behaviour.rb
plutonium-0.15.16 lib/plutonium/ui/component/behaviour.rb
plutonium-0.15.15 lib/plutonium/ui/component/behaviour.rb
plutonium-0.15.14 lib/plutonium/ui/component/behaviour.rb
plutonium-0.15.13 lib/plutonium/ui/component/behaviour.rb
plutonium-0.15.12 lib/plutonium/ui/component/behaviour.rb
plutonium-0.15.11 lib/plutonium/ui/component/behaviour.rb
plutonium-0.15.10 lib/plutonium/ui/component/behaviour.rb
plutonium-0.15.9 lib/plutonium/ui/component/behaviour.rb
plutonium-0.15.8 lib/plutonium/ui/component/behaviour.rb
plutonium-0.15.7 lib/plutonium/ui/component/behaviour.rb
plutonium-0.15.6 lib/plutonium/ui/component/behaviour.rb
plutonium-0.15.5 lib/plutonium/ui/component/behaviour.rb
plutonium-0.15.4 lib/plutonium/ui/component/behaviour.rb
plutonium-0.15.3 lib/plutonium/ui/component/behaviour.rb
plutonium-0.15.2 lib/plutonium/ui/component/behaviour.rb
plutonium-0.15.1 lib/plutonium/ui/component/behaviour.rb
plutonium-0.15.0 lib/plutonium/ui/component/behaviour.rb
plutonium-0.15.0.pre.rc3 lib/plutonium/ui/component/behaviour.rb