Sass::Script::Functions

Public Instance Methods

ie_hex_str(color) click to toggle source

polyfill sass < 3.2.6 (taken from sass 3.2.12):

# File lib/bootstrap-sass/sass_functions.rb, line 30
def ie_hex_str(color)
  assert_type color, :Color, :color
  alpha = (color.alpha * 255).round.to_s(16).rjust(2, '0')
  Sass::Script::String.new("##{alpha}#{color.send(:hex_str)[1..-1]}".upcase)
end
twbs_asset_path(source, type) click to toggle source
# File lib/bootstrap-sass/sass_functions.rb, line 15
def twbs_asset_path(source, type)
  url = if Bootstrap.asset_pipeline? && (context = sprockets_context)
          context.send(:"#{type}_path", source.value)
        elsif Bootstrap.compass?
          send(:"#{type}_url", source, Sass::Script::Bool.new(true)).value
        end

  # sass-only
  url ||= source.value.gsub('"', '')
  Sass::Script::String.new(url, :string)
end
twbs_font_path(source) click to toggle source
# File lib/bootstrap-sass/sass_functions.rb, line 5
def twbs_font_path(source)
  twbs_asset_path source, :font
end
twbs_image_path(source) click to toggle source
# File lib/bootstrap-sass/sass_functions.rb, line 10
def twbs_image_path(source)
  twbs_asset_path source, :image
end

Protected Instance Methods

sprockets_context() click to toggle source
# File lib/bootstrap-sass/sass_functions.rb, line 40
def sprockets_context
  # Modern way to get context:
  if options.key?(:sprockets)
    options[:sprockets][:context]
  # Compatibility with sprockets pre 2.10.0:
  elsif (importer = options[:importer]) && importer.respond_to?(:context)
    importer.context
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.