AutomatedInsightsInc/wordsmith-ruby-sdk

View on GitHub
lib/wordsmith/template_collection.rb

Summary

Maintainability
A
0 mins
Test Coverage
class Wordsmith::TemplateCollection

  def initialize(templates)
    @templates = templates
  end

  def find(slug)
    template = @templates.find {|t| t.slug == slug }
    template || raise(%Q(Template not found with slug: "#{slug}"))
  end

  def all
    @templates.dup
  end
end