class Govuk::DummyContentStore::ExampleRepository

Attributes

content_schemas_path[R]

Public Class Methods

new(content_schemas_path) click to toggle source
# File lib/govuk/dummy_content_store/example_repository.rb, line 9
def initialize(content_schemas_path)
  @content_schemas_path = Pathname.new(content_schemas_path)
end

Public Instance Methods

all() click to toggle source
# File lib/govuk/dummy_content_store/example_repository.rb, line 17
def all
  all_example_paths.lazy.map { |path| ExampleContentItem.new(path) }
end
find_by_base_path(base_path) click to toggle source
# File lib/govuk/dummy_content_store/example_repository.rb, line 13
def find_by_base_path(base_path)
  all.find { |item| item.base_path == base_path }
end

Private Instance Methods

all_example_paths() click to toggle source
# File lib/govuk/dummy_content_store/example_repository.rb, line 22
def all_example_paths
  Dir[content_schemas_path + "formats" + "*" + "frontend" + "examples" + "*.json"]
end