Class: Govuk::DummyContentStore::ExampleRepository

Inherits:
Object
  • Object
show all
Defined in:
lib/govuk/dummy_content_store/example_repository.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content_schemas_path) ⇒ ExampleRepository

Returns a new instance of ExampleRepository.



9
10
11
# 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

Instance Attribute Details

#content_schemas_pathObject (readonly)

Returns the value of attribute content_schemas_path.



7
8
9
# File 'lib/govuk/dummy_content_store/example_repository.rb', line 7

def content_schemas_path
  @content_schemas_path
end

Instance Method Details

#allObject



17
18
19
# 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) ⇒ Object



13
14
15
# 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