Module: Sho

Defined in:
lib/sho.rb,
lib/sho/version.rb,
lib/sho/configurator.rb,
lib/sho/argument_validator.rb

Overview

Sho is a small, non-framework view library based on Tilt.

`sho` object in an example below is an instance of Configurator, look at its docs to understand how to define rendering methods.

Examples:

class AnyClass
  include Sho

  sho.template :rendering_method_name, 'path/to/template.slim', :param1, param2: default_value
end

# with instance of AnyClass:
object.rendering_method_name(param1: 'foo', param2: 'bar') # => template.slim rendered

Defined Under Namespace

Classes: ArgumentValidator, Configurator

Constant Summary collapse

MAJOR =
0
MINOR =
0
PATCH =
2
PRE =
nil
VERSION =
[MAJOR, MINOR, PATCH, PRE].compact.join('.')

Class Method Summary collapse

Class Method Details

.included(mod) ⇒ Object

Adds `#sho` method (access to instance of Configurator) to class/module `Sho` is included into.


23
24
25
26
27
# File 'lib/sho.rb', line 23

def self.included(mod)
  mod.define_singleton_method(:sho) {
    @__sho_configurator__ ||= Configurator.new(mod)
  }
end