Class: Govuk::DummyContentStore::Content

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repository) ⇒ Content

Returns a new instance of Content.



10
11
12
# File 'lib/govuk/dummy_content_store/content.rb', line 10

def initialize(repository)
  @repository = repository
end

Instance Attribute Details

#repositoryObject (readonly)

Returns the value of attribute repository.



8
9
10
# File 'lib/govuk/dummy_content_store/content.rb', line 8

def repository
  @repository
end

Instance Method Details

#call(env) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/govuk/dummy_content_store/content.rb', line 14

def call(env)
  example = repository.find_by_base_path(env["PATH_INFO"])
  if example
    present_example(example)
  else
    present_not_found
  end
end