Sha256: daa378fd8a9e3e45377726dac0a7bc504614968b52dcc14b81ea45cd68e0c4f1
Contents?: true
Size: 663 Bytes
Versions: 1
Compression:
Stored size: 663 Bytes
Contents
module AssetHostCore module Loaders class AssetHost < Base SOURCE = "AssetHost" def self.build_from_url(url) assethost_root = "#{Rails.application.config.assethost.server}#{AssetHostCore::Engine.mounted_path}" matches = [ %r{#{assethost_root}\/i\/[^\/]+\/(?<id>\d+)-}, %r{#{assethost_root}\/api\/assets\/(?<id>\d+)} ] match = nil if matches.find { |m| match = url.match(m) } self.new(url: url, id: match[:id]) else nil end end #-------------- def load AssetHostCore::Asset.find_by_id(@id) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
asset_host_core-2.0.0.beta | lib/asset_host_core/loaders/asset_host.rb |