Module: Orange::Mixins::Template

Defined in:
lib/orange-core/middleware/template.rb

Instance Method Summary collapse

Instance Method Details

#template_chooser(&block) ⇒ Object



61
62
63
64
65
66
67
# File 'lib/orange-core/middleware/template.rb', line 61

def template_chooser(&block)
  if block_given?
    @template_chooser = Proc.new
  else
    @template_chooser ||= Proc.new {|packet| false}
  end
end

#template_for(packet) ⇒ Object



58
59
60
# File 'lib/orange-core/middleware/template.rb', line 58

def template_for(packet)
  template_chooser.call(packet)
end