Sha256: ebd71fa4eed4d71b5c9a1ce7e4ecccd5a25176fdd5d29d700bc0c01303b76995

Contents?: true

Size: 597 Bytes

Versions: 21

Compression:

Stored size: 597 Bytes

Contents

class Tutorial::FileLoader
  attr_reader :root, :code_language, :doc_name, :format

  def initialize(root:, code_language:, doc_name:, format: 'yml')
    @root          = root
    @code_language = code_language
    @doc_name      = doc_name
    @format        = format
  end

  def path
    @path ||= Nexmo::Markdown::DocFinder.find(
      root: root,
      document: doc_name,
      language: ::I18n.locale,
      code_language: code_language,
      format: format
    ).path
  end

  def content
    @content ||= File.read(path)
  end

  def yaml
    @yaml ||= YAML.safe_load(content)
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
station-0.0.118 lib/nexmo_developer/app/models/tutorial/file_loader.rb
station-0.0.115 lib/nexmo_developer/app/models/tutorial/file_loader.rb
station-0.0.114 lib/nexmo_developer/app/models/tutorial/file_loader.rb
station-0.0.113 lib/nexmo_developer/app/models/tutorial/file_loader.rb
station-0.0.112 lib/nexmo_developer/app/models/tutorial/file_loader.rb
station-0.0.111 lib/nexmo_developer/app/models/tutorial/file_loader.rb
station-0.0.110 lib/nexmo_developer/app/models/tutorial/file_loader.rb
station-0.0.109 lib/nexmo_developer/app/models/tutorial/file_loader.rb
station-0.0.108 lib/nexmo_developer/app/models/tutorial/file_loader.rb
station-0.0.107 lib/nexmo_developer/app/models/tutorial/file_loader.rb
station-0.0.106 lib/nexmo_developer/app/models/tutorial/file_loader.rb
station-0.0.105 lib/nexmo_developer/app/models/tutorial/file_loader.rb
station-0.0.104 lib/nexmo_developer/app/models/tutorial/file_loader.rb
station-0.0.103 lib/nexmo_developer/app/models/tutorial/file_loader.rb
station-0.0.102 lib/nexmo_developer/app/models/tutorial/file_loader.rb
station-0.0.101 lib/nexmo_developer/app/models/tutorial/file_loader.rb
station-0.0.100 lib/nexmo_developer/app/models/tutorial/file_loader.rb
station-0.0.97 lib/nexmo_developer/app/models/tutorial/file_loader.rb
station-0.0.96 lib/nexmo_developer/app/models/tutorial/file_loader.rb
station-0.0.95 lib/nexmo_developer/app/models/tutorial/file_loader.rb