Sha256: c08ec68a70dc78dcfb793bbad9c0c048cd60551f6fc232a3795e22137e3c130b

Contents?: true

Size: 1.12 KB

Versions: 5

Compression:

Stored size: 1.12 KB

Contents

require 'bh/classes/base'

module Bh
  module Classes
    # @api private
    class Cdn
      # @note if unspecified, the version should match the latest available
      #   version. If that's not the case, it's a bug and should be fixed.
      def self.bootstrap(options = {})
        options[:version] ||= '3.3.2'
        cdn_asset options.merge(library: 'bootstrap')
      end

      # @note if unspecified, the version should match the latest available
      #   version. If that's not the case, it's a bug and should be fixed.
      def self.font_awesome(options = {})
        options[:version] ||= '4.3.0'
        cdn_asset options.merge(library: 'font-awesome')
      end

    private

      def self.cdn_asset(options = {})
        version = options[:version]
        extension = options[:extension]
        name = options[:name]
        name = "#{name}.min" if options.fetch(:minified, true)
        library = options[:library]
        scheme = "#{options[:scheme]}:" if options[:scheme]
        host = "#{scheme}//netdna.bootstrapcdn.com"
        "#{host}/#{library}/#{version}/#{extension}/#{name}.#{extension}"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bh-1.3.5 lib/bh/classes/cdn.rb
bh-1.3.4 lib/bh/classes/cdn.rb
bh-1.3.3 lib/bh/classes/cdn.rb
bh-1.3.1 lib/bh/classes/cdn.rb
bh-1.3.0 lib/bh/classes/cdn.rb