Sha256: 78fba0677e0723336d8d1ca8edf91c82c28668cb0e572799811e95e86d4c1f3b

Contents?: true

Size: 730 Bytes

Versions: 2

Compression:

Stored size: 730 Bytes

Contents

module Compass::Util
  extend self

  def compass_warn(*args)
    Sass::Util.sass_warn(*args)
  end

  def blank?(value)
    case value
    when NilClass, FalseClass
      true
    when String, Array
      value.length.zero?
    else
      false
    end
  end

  def assert_valid_keys(hash, *keys)
    keys = keys.inject([]) {|m, k| m << k; m << k.to_s if k.is_a?(Symbol); m}
    invalid_keys = hash.keys - keys
    if invalid_keys.any?
      raise ArgumentError, "Invalid key#{'s' if invalid_keys.size > 1} found: #{invalid_keys.map{|k| k.inspect}.sort.join(", ")}"
    end
  end

  def symbolize_keys!(hash)
    hash.keys.select {|k| k.is_a?(String)}.each do |k|
      hash[k.to_sym] = hash.delete(k)
    end
    nil
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
compass-core-1.1.0.alpha.3 lib/compass/util.rb
compass-core-1.1.0.alpha.2 lib/compass/util.rb