Class: SocialAvatarProxy::Engine

Inherits:
Rails::Engine
  • Object
show all
Defined in:
lib/social_avatar_proxy/engine.rb

Defined Under Namespace

Modules: Helpers

Class Method Summary collapse

Class Method Details

.calculate_mounted_atObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/social_avatar_proxy/engine.rb', line 12

def self.calculate_mounted_at
  route ||= Rails.application.routes.routes.detect do |route|
    route.app == self
  end
  # if it's not found, it's not mounted
  unless route
    raise "#{self} is not yet mounted."
  end
  # return the route with it's slashes stripped
  route.path.spec.to_s.gsub(/^\/|\/$/, "")
end

.mounted_atObject



8
9
10
# File 'lib/social_avatar_proxy/engine.rb', line 8

def self.mounted_at
  @mounted_at ||= calculate_mounted_at
end