Sha256: 13537d8abac75df623cea7155ce10a5babf347229dcb393d69756148d4d855f9
Contents?: true
Size: 718 Bytes
Versions: 76
Compression:
Stored size: 718 Bytes
Contents
class ImprovePagePresenter def initialize(document_path) @document_path = document_path end def github_url @github_url ||= "https://github.com/#{docs_repo}/blob/#{ENV.fetch('branch', 'main')}/#{path_to_url}" end def docs_repo @docs_repo ||= begin path_to_url.start_with?('lib/nexmo_developer/app/') ? 'nexmo/station' : YAML.safe_load(File.open("#{Rails.configuration.docs_base_path}/config/business_info.yml"))['docs_repo'] end end def path_to_url @path_to_url ||= begin @document_path&.gsub!("#{Rails.configuration.docs_base_path}/", '') @document_path.start_with?('app/views') ? @document_path.prepend('lib/nexmo_developer/') : @document_path end end end
Version data entries
76 entries across 76 versions & 1 rubygems