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

Version Path
station-0.5.16 lib/nexmo_developer/app/presenters/improve_page_presenter.rb
station-0.5.15 lib/nexmo_developer/app/presenters/improve_page_presenter.rb
station-0.5.14 lib/nexmo_developer/app/presenters/improve_page_presenter.rb
station-0.5.13 lib/nexmo_developer/app/presenters/improve_page_presenter.rb
station-0.5.12 lib/nexmo_developer/app/presenters/improve_page_presenter.rb
station-0.5.11 lib/nexmo_developer/app/presenters/improve_page_presenter.rb
station-0.5.10 lib/nexmo_developer/app/presenters/improve_page_presenter.rb
station-0.5.9 lib/nexmo_developer/app/presenters/improve_page_presenter.rb
station-0.5.8 lib/nexmo_developer/app/presenters/improve_page_presenter.rb
station-0.5.7 lib/nexmo_developer/app/presenters/improve_page_presenter.rb
station-0.5.6 lib/nexmo_developer/app/presenters/improve_page_presenter.rb
station-0.5.5 lib/nexmo_developer/app/presenters/improve_page_presenter.rb
station-0.5.4 lib/nexmo_developer/app/presenters/improve_page_presenter.rb
station-0.5.3 lib/nexmo_developer/app/presenters/improve_page_presenter.rb
station-0.5.2 lib/nexmo_developer/app/presenters/improve_page_presenter.rb
station-0.5.1 lib/nexmo_developer/app/presenters/improve_page_presenter.rb
station-0.5.0 lib/nexmo_developer/app/presenters/improve_page_presenter.rb
station-0.4.9 lib/nexmo_developer/app/presenters/improve_page_presenter.rb
station-0.4.8 lib/nexmo_developer/app/presenters/improve_page_presenter.rb
station-0.4.7 lib/nexmo_developer/app/presenters/improve_page_presenter.rb