class Dialogue::TemplateFactory
Attributes
templates[R]
Public Class Methods
new()
click to toggle source
# File lib/dialogue/template_factory.rb, line 9 def initialize @templates = [] end
Public Instance Methods
find(name)
click to toggle source
# File lib/dialogue/template_factory.rb, line 13 def find(name) templates.find { |template| template.name.to_s == name.to_s } end
register(template)
click to toggle source
# File lib/dialogue/template_factory.rb, line 17 def register(template) raise TemplateAlreadyRegisteredError.new(template) if registered?(template.name) templates << template end
registered?(name)
click to toggle source
# File lib/dialogue/template_factory.rb, line 22 def registered?(name) !find(name).nil? end