Module: Lotus::Layout

Defined in:
lib/lotus/layout.rb

Overview

Layout

See Also:

Since:

  • 0.1.0

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Register a layout

Examples:

require 'lotus/view'

class ApplicationLayout
  include Lotus::Layout
end

Since:

  • 0.1.0



23
24
25
26
27
28
29
30
# File 'lib/lotus/layout.rb', line 23

def self.included(base)
  base.class_eval do
    extend Lotus::View::Dsl.dup
    extend ClassMethods
  end

  Lotus::View.layouts.add(base)
end

Instance Method Details

#initialize(scope, rendered) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize a layout

Parameters:

See Also:

Since:

  • 0.1.0



107
108
109
# File 'lib/lotus/layout.rb', line 107

def initialize(scope, rendered)
  @scope, @rendered = View::Rendering::LayoutScope.new(self, scope), rendered
end

#renderString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Render the layout

Returns:

  • (String)

    the output of the rendering process

See Also:

Since:

  • 0.1.0



119
120
121
# File 'lib/lotus/layout.rb', line 119

def render
  template.render(@scope, &Proc.new{@rendered})
end