class Govuk::DummyContentStore::ExampleContentItem

Attributes

path[R]

Public Class Methods

new(path) click to toggle source
# File lib/govuk/dummy_content_store/example_content_item.rb, line 8
def initialize(path)
  @path = path
end

Public Instance Methods

base_path() click to toggle source
# File lib/govuk/dummy_content_store/example_content_item.rb, line 16
def base_path
  data["base_path"]
end
data() click to toggle source
# File lib/govuk/dummy_content_store/example_content_item.rb, line 32
def data
  JSON.parse(raw_data)
end
filename() click to toggle source
# File lib/govuk/dummy_content_store/example_content_item.rb, line 12
def filename
  File.basename(path)
end
format() click to toggle source
# File lib/govuk/dummy_content_store/example_content_item.rb, line 20
def format
  data["format"]
end
raw_data() click to toggle source
# File lib/govuk/dummy_content_store/example_content_item.rb, line 36
def raw_data
  File.read(path, encoding: "UTF-8")
end
title() click to toggle source
# File lib/govuk/dummy_content_store/example_content_item.rb, line 24
def title
  data["title"]
end
view_url() click to toggle source
# File lib/govuk/dummy_content_store/example_content_item.rb, line 28
def view_url
  "/content#{base_path}"
end