Module: Phlex::Rails::Layout

Defined Under Namespace

Modules: Interface

Class Method Summary collapse

Instance Method Summary collapse

Methods included from HelperMacros

#register_builder_yielding_helper, #register_output_helper, #register_value_helper

Class Method Details

.included(base) ⇒ Object



41
42
43
44
45
46
47
48
# File 'lib/phlex/rails/layout.rb', line 41

def self.included(base)
  unless base < Phlex::HTML
    raise Phlex::ArgumentError.new("👋 #{name} should only be included into Phlex::HTML classes.")
  end

  base.extend(Interface)
  super
end

Instance Method Details

#identifierObject



65
66
67
# File 'lib/phlex/rails/layout.rb', line 65

def identifier
  self.class.identifier
end

#render(view_context = nil, *args, **kwargs, &block) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/phlex/rails/layout.rb', line 50

def render(view_context = nil, *args, **kwargs, &block)
  if @_state
    super
  else
    render_in(view_context) do |yielded|
      case yielded
      when Symbol
        raw view_context.view_flow.get(yielded)
      else
        yield
      end
    end
  end
end

#virtual_pathObject



69
70
71
# File 'lib/phlex/rails/layout.rb', line 69

def virtual_path
  self.class.virtual_path
end