Class: Wordsmith::TemplateCollection
- Inherits:
-
Object
- Object
- Wordsmith::TemplateCollection
- Defined in:
- lib/wordsmith/template_collection.rb
Instance Method Summary collapse
- #all ⇒ Object
- #find(slug) ⇒ Object
-
#initialize(templates) ⇒ TemplateCollection
constructor
A new instance of TemplateCollection.
Constructor Details
#initialize(templates) ⇒ TemplateCollection
Returns a new instance of TemplateCollection.
3 4 5 |
# File 'lib/wordsmith/template_collection.rb', line 3 def initialize(templates) @templates = templates end |
Instance Method Details
#all ⇒ Object
12 13 14 |
# File 'lib/wordsmith/template_collection.rb', line 12 def all @templates.dup end |
#find(slug) ⇒ Object
7 8 9 10 |
# File 'lib/wordsmith/template_collection.rb', line 7 def find(slug) template = @templates.find {|t| t.slug == slug } template || raise(%Q(Template not found with slug: "#{slug}")) end |