Sha256: fa8e855777136e5e54b975a9f8db3d5c1c6fa349aabe94a202691385bcec2e87

Contents?: true

Size: 548 Bytes

Versions: 10

Compression:

Stored size: 548 Bytes

Contents

module Compass::SassExtensions::Functions::Constants
  # returns the opposite position of a side or corner.
  def opposite_position(position)
    opposite = position.value.split(/ +/).map do |pos|
      case pos
      when "top" then "bottom"
      when "bottom" then "top"
      when "left" then "right"
      when "right" then "left"
      when "center" then "center"
      else
        raise Sass::SyntaxError, "Cannot determine the opposite of #{pos}"
      end
    end
    Sass::Script::String.new(opposite.join(" "), position.type)
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
compass-0.10.6 lib/compass/sass_extensions/functions/constants.rb
compass-0.10.6.pre.1 lib/compass/sass_extensions/functions/constants.rb
compass-0.10.5 lib/compass/sass_extensions/functions/constants.rb
compass-0.10.5.pre.1 lib/compass/sass_extensions/functions/constants.rb
compass-0.10.4 lib/compass/sass_extensions/functions/constants.rb
compass-0.10.4.pre.4 lib/compass/sass_extensions/functions/constants.rb
compass-0.10.4.pre.3 lib/compass/sass_extensions/functions/constants.rb
compass-0.10.4.pre.2 lib/compass/sass_extensions/functions/constants.rb
compass-0.10.3 lib/compass/sass_extensions/functions/constants.rb
compass-0.10.3.pre.1 lib/compass/sass_extensions/functions/constants.rb