### Home Classes Methods

### In Files

- lib/sass/util/normalized_map.rb

### Parent

Object

### Methods

- ::new
- #[]
- #[]=
- #as_stored
- #delete
- #denormalize
- #dup
- #each
- #empty?
- #has_key?
- #keys
- #map
- #method_missing
- #normalize
- #respond_to?
- #respond_to_missing?
- #size
- #sort_by
- #to_a
- #to_hash
- #update
- #values

### Class/Module Index

Quicksearch

- Sass
- Sass::BaseEnvironment
- Sass::CSS
- Sass::CacheStores
- Sass::CacheStores::Base
- Sass::CacheStores::Chain
- Sass::CacheStores::Filesystem
- Sass::CacheStores::Memory
- Sass::CacheStores::Null
- Sass::Callbacks
- Sass::Callbacks::InstanceMethods
- Sass::Engine
- Sass::Engine::Line
- Sass::Environment
- Sass::Exec
- Sass::Exec::Base
- Sass::Exec::SassConvert
- Sass::Exec::SassScss
- Sass::Exec::SassScss::Sass::Plugin.compiler
- Sass::Features
- Sass::Importers
- Sass::Importers::Base
- Sass::Importers::Filesystem
- Sass::Logger
- Sass::Logger::Base
- Sass::Logger::LogLevel
- Sass::Logger::LogLevel::ClassMethods
- Sass::Media
- Sass::Media::Query
- Sass::Media::QueryList
- Sass::Plugin
- Sass::Plugin::Compiler
- Sass::Plugin::Configuration
- Sass::Plugin::MerbBootLoader
- Sass::Plugin::Rack
- Sass::Plugin::StalenessChecker
- Sass::ReadOnlyEnvironment
- Sass::Repl
- Sass::SCSS
- Sass::SCSS::CssParser
- Sass::SCSS::Parser
- Sass::SCSS::RX
- Sass::SCSS::ScriptLexer
- Sass::SCSS::ScriptParser
- Sass::SCSS::StaticParser
- Sass::Script
- Sass::Script::CssLexer
- Sass::Script::CssParser
- Sass::Script::Functions
- Sass::Script::Functions::EvaluationContext
- Sass::Script::Lexer
- Sass::Script::Parser
- Sass::Script::Tree
- Sass::Script::Tree::Funcall
- Sass::Script::Tree::Interpolation
- Sass::Script::Tree::ListLiteral
- Sass::Script::Tree::Literal
- Sass::Script::Tree::MapLiteral
- Sass::Script::Tree::Node
- Sass::Script::Tree::Operation
- Sass::Script::Tree::Selector
- Sass::Script::Tree::StringInterpolation
- Sass::Script::Tree::UnaryOperation
- Sass::Script::Tree::Variable
- Sass::Script::Value
- Sass::Script::Value::ArgList
- Sass::Script::Value::Base
- Sass::Script::Value::Bool
- Sass::Script::Value::Color
- Sass::Script::Value::Helpers
- Sass::Script::Value::List
- Sass::Script::Value::Map
- Sass::Script::Value::Null
- Sass::Script::Value::Number
- Sass::Script::Value::String
- Sass::Selector
- Sass::Selector::AbstractSequence
- Sass::Selector::Attribute
- Sass::Selector::Class
- Sass::Selector::CommaSequence
- Sass::Selector::Element
- Sass::Selector::Id
- Sass::Selector::Parent
- Sass::Selector::Placeholder
- Sass::Selector::Pseudo
- Sass::Selector::Sequence
- Sass::Selector::Simple
- Sass::Selector::SimpleSequence
- Sass::Selector::Universal
- Sass::SemiGlobalEnvironment
- Sass::Shared
- Sass::Source
- Sass::Source::Map
- Sass::Source::Map::Mapping
- Sass::Source::Position
- Sass::Source::Range
- Sass::Stack
- Sass::Stack::Frame
- Sass::Supports
- Sass::Supports::Condition
- Sass::Supports::Declaration
- Sass::Supports::Interpolation
- Sass::Supports::Negation
- Sass::Supports::Operator
- Sass::SyntaxError
- Sass::Tree
- Sass::Tree::AtRootNode
- Sass::Tree::CharsetNode
- Sass::Tree::CommentNode
- Sass::Tree::ContentNode
- Sass::Tree::CssImportNode
- Sass::Tree::DebugNode
- Sass::Tree::DirectiveNode
- Sass::Tree::EachNode
- Sass::Tree::ErrorNode
- Sass::Tree::ExtendNode
- Sass::Tree::ForNode
- Sass::Tree::FunctionNode
- Sass::Tree::IfNode
- Sass::Tree::ImportNode
- Sass::Tree::KeyframeRuleNode
- Sass::Tree::MediaNode
- Sass::Tree::MixinDefNode
- Sass::Tree::MixinNode
- Sass::Tree::Node
- Sass::Tree::PropNode
- Sass::Tree::ReturnNode
- Sass::Tree::RootNode
- Sass::Tree::RuleNode
- Sass::Tree::SupportsNode
- Sass::Tree::TraceNode
- Sass::Tree::VariableNode
- Sass::Tree::Visitors
- Sass::Tree::Visitors::Base
- Sass::Tree::Visitors::CheckNesting
- Sass::Tree::Visitors::Convert
- Sass::Tree::Visitors::Cssize
- Sass::Tree::Visitors::Cssize::Bubble
- Sass::Tree::Visitors::DeepCopy
- Sass::Tree::Visitors::Extend
- Sass::Tree::Visitors::Perform
- Sass::Tree::Visitors::SetOptions
- Sass::Tree::Visitors::ToCss
- Sass::Tree::WarnNode
- Sass::Tree::WhileNode
- Sass::UnitConversionError
- Sass::Util
- Sass::Util::CrossPlatformRandom
- Sass::Util::MultibyteStringScanner
- Sass::Util::NormalizedMap
- Sass::Util::StaticConditionalContext
- Sass::Util::SubsetMap
- Sass::Util::Test
- Sass::Version
- ActionController
- ActionController::Base
- Object
- OrderedHash

No matching classes.

# Sass::Util::NormalizedMap

### Public Class Methods

new(map = nil) click to toggle source

Create a normalized map

    # File lib/sass/util/normalized_map.rb, line 12
    def initialize(map = nil)
      @key_strings = {}
      @map = Util.ruby1_8? ? OrderedHash.new : {}

      map.each {|key, value| self[key] = value} if map
    end

### Public Instance Methods

[](k) click to toggle source

@private

    # File lib/sass/util/normalized_map.rb, line 44
    def [](k)
      @map[normalize(k)]
    end

[]=(k, v) click to toggle source

@private

    # File lib/sass/util/normalized_map.rb, line 36
    def []=(k, v)
      normalized = normalize(k)
      @map[normalized] = v
      @key_strings[normalized] = k
      v
    end

as_stored() click to toggle source

@return [Hash] Hash with the keys as they were stored (before normalization).

    # File lib/sass/util/normalized_map.rb, line 61
    def as_stored
      Sass::Util.map_keys(@map) {|k| @key_strings[k]}
    end

delete(k) click to toggle source

@private

    # File lib/sass/util/normalized_map.rb, line 54
    def delete(k)
      normalized = normalize(k)
      @key_strings.delete(normalized)
      @map.delete(normalized)
    end

denormalize(key) click to toggle source

Returns the version of `key` as it was stored before normalization. If `key` isn’t in the map, returns it as it was passed in.

@return [String]

    # File lib/sass/util/normalized_map.rb, line 31
    def denormalize(key)
      @key_strings[normalize(key)] || key
    end

dup() click to toggle source

    # File lib/sass/util/normalized_map.rb, line 97
    def dup
      d = super
      d.send(:instance_variable_set, "@map", @map.dup)
      d
    end

each() click to toggle source

    # File lib/sass/util/normalized_map.rb, line 77
    def each
      @map.each {|k, v| yield(k, v)}
    end

empty?() click to toggle source

    # File lib/sass/util/normalized_map.rb, line 65
    def empty?
      @map.empty?
    end

has_key?(k) click to toggle source

@private

    # File lib/sass/util/normalized_map.rb, line 49
    def has_key?(k)
      @map.has_key?(normalize(k))
    end

keys() click to toggle source

    # File lib/sass/util/normalized_map.rb, line 73
    def keys
      @map.keys
    end

map() click to toggle source

    # File lib/sass/util/normalized_map.rb, line 93
    def map
      @map.map {|k, v| yield(k, v)}
    end

method_missing(method, *args, &block) click to toggle source

    # File lib/sass/util/normalized_map.rb, line 112
    def method_missing(method, *args, &block)
      if Sass.tests_running
        raise ArgumentError.new("The method #{method} must be implemented explicitly")
      end
      @map.send(method, *args, &block)
    end

normalize(key) click to toggle source

Specifies how to transform the key.

This can be overridden to create other normalization behaviors.

    # File lib/sass/util/normalized_map.rb, line 22
    def normalize(key)
      key.tr("-", "_")
    end

respond_to?(method, include_private = false) click to toggle source

    # File lib/sass/util/normalized_map.rb, line 120
    def respond_to?(method, include_private = false)
      super || @map.respond_to?(method, include_private)
    end

respond_to_missing?(method, include_private = false) click to toggle source

    # File lib/sass/util/normalized_map.rb, line 125
    def respond_to_missing?(method, include_private = false)
      @map.respond_to?(method, include_private)
    end

size() click to toggle source

    # File lib/sass/util/normalized_map.rb, line 81
    def size
      @map.size
    end

sort_by() click to toggle source

    # File lib/sass/util/normalized_map.rb, line 103
    def sort_by
      @map.sort_by {|k, v| yield k, v}
    end

to_a() click to toggle source

    # File lib/sass/util/normalized_map.rb, line 89
    def to_a
      @map.to_a
    end

to_hash() click to toggle source

    # File lib/sass/util/normalized_map.rb, line 85
    def to_hash
      @map.dup
    end

update(map) click to toggle source

    # File lib/sass/util/normalized_map.rb, line 107
    def update(map)
      map = map.as_stored if map.is_a?(NormalizedMap)
      map.each {|k, v| self[k] = v}
    end

values() click to toggle source

    # File lib/sass/util/normalized_map.rb, line 69
    def values
      @map.values
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.