class Bonanza::LinkStrategies::Base

Attributes

entity[R]

Public Class Methods

new(entity = nil) click to toggle source
# File lib/bonanza/link_strategies/base.rb, line 11
def initialize(entity = nil)
  @entity = entity.to_s
end

Public Instance Methods

app() click to toggle source
# File lib/bonanza/link_strategies/base.rb, line 15
def app
  self.class.name.demodulize.downcase
end
domain() click to toggle source
# File lib/bonanza/link_strategies/base.rb, line 23
def domain
  case environment.to_s
  when 'development'
    "http://#{app}.dev"
  when 'test'
    "http://#{app}.test"
  when 'staging'
    "https://#{app}-staging.nine.ch"
  when 'production'
    "https://#{app}.nine.ch"
  end
end
environment() click to toggle source
# File lib/bonanza/link_strategies/base.rb, line 40
def environment
  ENV.fetch('RAILS_ENV', 'production')
end
paths() click to toggle source
# File lib/bonanza/link_strategies/base.rb, line 19
def paths
  {}
end
url_to(entity, reference = nil) click to toggle source
# File lib/bonanza/link_strategies/base.rb, line 36
def url_to(entity, reference = nil)
  raw [domain, paths[entity]].join % { reference: reference }
end