class ImprovePagePresenter
Public Class Methods
new(document_path)
click to toggle source
# File lib/nexmo_developer/app/presenters/improve_page_presenter.rb, line 2 def initialize(document_path) @document_path = document_path end
Public Instance Methods
docs_repo()
click to toggle source
# File lib/nexmo_developer/app/presenters/improve_page_presenter.rb, line 10 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
github_url()
click to toggle source
# File lib/nexmo_developer/app/presenters/improve_page_presenter.rb, line 6 def github_url @github_url ||= "https://github.com/#{docs_repo}/blob/#{ENV.fetch('branch', 'main')}/#{path_to_url}" end
path_to_url()
click to toggle source
# File lib/nexmo_developer/app/presenters/improve_page_presenter.rb, line 16 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