Module: HTML::Template::Internal

Defined in:
lib/html/template/pro.rb,
ext/html/template/internal.c

Overview

:nodoc:

Defined Under Namespace

Classes: State

Class Method Summary collapse

Class Method Details

.register_functions_impl(registory, func_spec, &block) ⇒ Object

:nodoc:



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/html/template/pro.rb', line 15

def register_functions_impl(registory, func_spec, &block) # :nodoc:
  if block && func_spec.kind_of?(Symbol)
    registory[func_spec] = block
  elsif func_spec.kind_of? Hash
    unless func_spec.values.all?{|e| e.kind_of? Proc}
      raise ArgumentError, "functions must be kind_of Proc"
    end
    registory.update(func_spec)
  else
    raise ArgumentError, "first argument must be symbol or hash contains functions"
  end
end