Module: Hanlon

Defined in:
lib/hanlon.rb,
lib/hanlon/version.rb,
lib/hanlon/methods_finder.rb,
lib/hanlon/template_loader.rb

Defined Under Namespace

Modules: TemplateLoader Classes: MethodsFinder

Constant Summary collapse

VERSION =
"0.0.3"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



7
8
9
# File 'lib/hanlon.rb', line 7

def self.included base
  base.extend TemplateLoader
end

Instance Method Details

#execute_hanlon(engine, name, *args) ⇒ Object



11
12
13
14
15
# File 'lib/hanlon.rb', line 11

def execute_hanlon engine, name, *args
  @method_being_searched_for = name
  @arguments_for_method = args
  engine.render self
end

#hanlon(name, &block) ⇒ Object



17
18
19
20
21
# File 'lib/hanlon.rb', line 17

def hanlon name, &block
  (name.to_s == @method_being_searched_for) ?
    block.call(*@arguments_for_method) :
    ''
end