Sha256: 5ba363bf23a949addf586dbcdbe21b81a4c1454d3609935de25b5e913b7c51f3

Contents?: true

Size: 898 Bytes

Versions: 5

Compression:

Stored size: 898 Bytes

Contents

module Polymer
  class CSSGenerator

    # --- Class Methods ------------------------------------------------------

    # Returns a string which may be used as the background statement for the
    # given sprite and source pair.
    #
    # @param [Polymer::Sprite] sprite
    # @param [Polymer::Source] source
    #
    # @return [String]
    #
    def self.background_statement(sprite, source)
      "background: url(#{sprite.url}) 0 " \
      "#{-sprite.position_of(source)}px no-repeat;"
    end

    # Returns a string which may be used as the background-position statement
    # for the given sprite and source pair.
    #
    # @param [Polymer::Sprite] sprite
    # @param [Polymer::Source] source
    #
    # @return [String]
    #
    def self.position_statement(sprite, source)
      "background-position: 0 #{-sprite.position_of(source)}px;"
    end

  end # CSSGenerator
end # Polymer

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
polymer-1.0.0.beta.7 lib/polymer/css_generator.rb
polymer-1.0.0.beta.6 lib/polymer/css_generator.rb
polymer-1.0.0.beta.5 lib/polymer/css_generator.rb
polymer-1.0.0.beta.4 lib/polymer/css_generator.rb
polymer-1.0.0.beta.3 lib/polymer/css_generator.rb