Module: Bh::CdnHelper

Defined in:
lib/bh/helpers/cdn_helper.rb

Overview

Provides methods to retrieve the URLs of Bootstrap stylesheets and Javascript files from Bootstrap CDN

Instance Method Summary collapse

Instance Method Details

#bootstrap_css(options = {}) ⇒ String

Returns the URL of the Bootstrap CSS file.

Parameters:

  • options (Hash) (defaults to: {})

    the options for which CSS file to retrieve.

Options Hash (options):

  • :version (String)

    the version of Bootstrap.

  • :scheme (String)

    the URI scheme to use.

  • :minified (Boolean)

    whether to use the minified version.

Returns:

  • (String)

    the URL of the Bootstrap CSS file



11
12
13
# File 'lib/bh/helpers/cdn_helper.rb', line 11

def bootstrap_css(options = {})
  bootstrap_asset options.merge(name: 'bootstrap', extension: 'css')
end

#bootstrap_js(options = {}) ⇒ String

Returns the URL of the Bootstrap JS file.

Parameters:

  • options (Hash) (defaults to: {})

    the options for which JS file to retrieve.

Options Hash (options):

  • :version (String)

    the version of Bootstrap.

  • :scheme (String)

    the URI scheme to use.

  • :minified (Boolean)

    whether to use the minified version.

Returns:

  • (String)

    the URL of the Bootstrap JS file



39
40
41
# File 'lib/bh/helpers/cdn_helper.rb', line 39

def bootstrap_js(options = {})
  bootstrap_asset options.merge(name: 'bootstrap', extension: 'js')
end

#bootstrap_theme_css(options = {}) ⇒ String

Returns the URL of the Bootstrap Theme CSS file.

Parameters:

  • options (Hash) (defaults to: {})

    the options for which CSS file to retrieve.

Options Hash (options):

  • :version (String)

    the version of Bootstrap.

  • :scheme (String)

    the URI scheme to use.

  • :minified (Boolean)

    whether to use the minified version.

Returns:

  • (String)

    the URL of the Bootstrap Theme CSS file



20
21
22
# File 'lib/bh/helpers/cdn_helper.rb', line 20

def bootstrap_theme_css(options = {})
  bootstrap_asset options.merge(name: 'bootstrap-theme', extension: 'css')
end

#font_awesome_css(options = {}) ⇒ String

Returns the URL of the Font Awesome CSS file.

Parameters:

  • options (Hash) (defaults to: {})

    the options for which CSS file to retrieve.

Options Hash (options):

  • :version (String)

    the version of Font Awesome.

  • :scheme (String)

    the URI scheme to use.

  • :minified (Boolean)

    whether to use the minified version.

Returns:

  • (String)

    the URL of the Font Awesome CSS file

See Also:



30
31
32
# File 'lib/bh/helpers/cdn_helper.rb', line 30

def font_awesome_css(options = {})
  font_awesome_asset options.merge(name: 'font-awesome', extension: 'css')
end