### Home Classes Methods

### In Files

- lib/compass/configuration/serialization.rb

### Methods

- #_parse
- #get_binding
- #issue_deprecation_warnings
- #parse
- #parse_string
- #serialize
- #serialize_property

### Class/Module Index

Quicksearch

- Compass
- Compass::Actions
- Compass::AppIntegration
- Compass::AppIntegration::Helpers
- Compass::AppIntegration::Rails
- Compass::AppIntegration::StandAlone
- Compass::AppIntegration::StandAlone::ConfigurationDefaults
- Compass::AppIntegration::StandAlone::Installer
- Compass::BrowserSupport
- Compass::Commands
- Compass::Commands::Base
- Compass::Commands::CleanProject
- Compass::Commands::CleanProjectOptionsParser
- Compass::Commands::CompileProjectOptionsParser
- Compass::Commands::ConfigurationOptionsParser
- Compass::Commands::CreateProject
- Compass::Commands::CreateProjectOptionsParser
- Compass::Commands::Default
- Compass::Commands::DefaultOptionsParser
- Compass::Commands::ExtensionCommand
- Compass::Commands::ExtensionOptionsParser
- Compass::Commands::ExtensionsOptionParser
- Compass::Commands::GenerateGridBackground
- Compass::Commands::GridBackgroundOptionsParser
- Compass::Commands::Help
- Compass::Commands::HelpOptionsParser
- Compass::Commands::Imports
- Compass::Commands::InstallerCommand
- Compass::Commands::Interactive
- Compass::Commands::InteractiveOptionsParser
- Compass::Commands::ListFrameworks
- Compass::Commands::MemoryDebugger
- Compass::Commands::PrintVersion
- Compass::Commands::ProjectBase
- Compass::Commands::ProjectStats
- Compass::Commands::Registry
- Compass::Commands::Sprite
- Compass::Commands::SpriteOptionsParser
- Compass::Commands::StampPattern
- Compass::Commands::StampPatternOptionsParser
- Compass::Commands::StatsOptionsParser
- Compass::Commands::StructureOptionsParser
- Compass::Commands::UnpackExtension
- Compass::Commands::UpdateProject
- Compass::Commands::ValidateProject
- Compass::Commands::ValidationOptionsParser
- Compass::Commands::VersionOptionsParser
- Compass::Commands::WatchProject
- Compass::Commands::WatchProjectOptionsParser
- Compass::Commands::WriteConfiguration
- Compass::Compiler
- Compass::Configuration
- Compass::Configuration::Adapters
- Compass::Configuration::Comments
- Compass::Configuration::Data
- Compass::Configuration::Defaults
- Compass::Configuration::FileData
- Compass::Configuration::Helpers
- Compass::Configuration::Inheritance
- Compass::Configuration::Inheritance::ClassMethods
- Compass::Configuration::Inheritance::ClassMethods::ArrayProxy
- Compass::Configuration::Inheritance::InstanceMethods
- Compass::Configuration::Paths
- Compass::Configuration::Serialization
- Compass::Error
- Compass::Exec
- Compass::Exec::CommandOptionParser
- Compass::Exec::GlobalOptionsParser
- Compass::Exec::Helpers
- Compass::Exec::ProjectOptionsParser
- Compass::Exec::SubCommandUI
- Compass::Exec::SwitchUI
- Compass::FilesystemConflict
- Compass::Frameworks
- Compass::Frameworks::Framework
- Compass::GridBuilder
- Compass::Installers
- Compass::Installers::BareInstaller
- Compass::Installers::Base
- Compass::Installers::Manifest
- Compass::Installers::Manifest::Entry
- Compass::Installers::ManifestInstaller
- Compass::Installers::TemplateContext
- Compass::Logger
- Compass::MissingDependency
- Compass::NullLogger
- Compass::PNG
- Compass::SassExtensions
- Compass::SassExtensions::Functions
- Compass::SassExtensions::Functions::Colors
- Compass::SassExtensions::Functions::Constants
- Compass::SassExtensions::Functions::CrossBrowserSupport
- Compass::SassExtensions::Functions::CrossBrowserSupport::CSS2FallbackValue
- Compass::SassExtensions::Functions::Display
- Compass::SassExtensions::Functions::Enumerate
- Compass::SassExtensions::Functions::Env
- Compass::SassExtensions::Functions::FontFiles
- Compass::SassExtensions::Functions::GradientSupport
- Compass::SassExtensions::Functions::GradientSupport::Assertions
- Compass::SassExtensions::Functions::GradientSupport::ColorStop
- Compass::SassExtensions::Functions::GradientSupport::Functions
- Compass::SassExtensions::Functions::GradientSupport::Gradient
- Compass::SassExtensions::Functions::GradientSupport::Gradient::ClassMethods
- Compass::SassExtensions::Functions::GradientSupport::LinearGradient
- Compass::SassExtensions::Functions::GradientSupport::RadialGradient
- Compass::SassExtensions::Functions::ImageSize
- Compass::SassExtensions::Functions::ImageSize::ImageProperties
- Compass::SassExtensions::Functions::ImageSize::JPEG
- Compass::SassExtensions::Functions::InlineImage
- Compass::SassExtensions::Functions::Lists
- Compass::SassExtensions::Functions::Math
- Compass::SassExtensions::Functions::Selectors
- Compass::SassExtensions::Functions::Sprites
- Compass::SassExtensions::Functions::Sprites::VariableReader
- Compass::SassExtensions::Functions::Urls
- Compass::SassExtensions::Functions::Urls::FontUrl
- Compass::SassExtensions::Functions::Urls::GeneratedImageUrl
- Compass::SassExtensions::Functions::Urls::ImageUrl
- Compass::SassExtensions::Functions::Urls::StylesheetUrl
- Compass::SassExtensions::Sprites
- Compass::SassExtensions::Sprites::ChunkyPngEngine
- Compass::SassExtensions::Sprites::Engine
- Compass::SassExtensions::Sprites::Image
- Compass::SassExtensions::Sprites::ImageMethods
- Compass::SassExtensions::Sprites::ImageRow
- Compass::SassExtensions::Sprites::LayoutMethods
- Compass::SassExtensions::Sprites::RowFitter
- Compass::SassExtensions::Sprites::SpriteMap
- Compass::SassExtensions::Sprites::SpriteMethods
- Compass::SpriteException
- Compass::SpriteImporter
- Compass::Sprites
- Compass::Sprites::Binding
- Compass::Stats
- Compass::Stats::CssFile
- Compass::Stats::SassFile
- Compass::Stats::StatsVisitor
- Compass::TestCase
- Compass::Util
- Compass::Version
- Sass
- Sass::Script
- Sass::Script::CrossBrowserFunctionCall
- Sass::Script::Funcall
- Sass::Script::Functions
- Sass::Script::Functions::EvaluationContext
- Sass::Script::HasSimpleCrossBrowserFunctionSupport
- Sass::Script::List
- Sass::Tree
- Sass::Tree::Node
- QuickCache

No matching classes.

# Compass::Configuration::Serialization

The serialization module manages reading and writing the configuration file(s).

### Public Instance Methods

_parse(config_file) click to toggle source

parses a configuration file which is a ruby script

    # File lib/compass/configuration/serialization.rb, line 10
    def _parse(config_file)
      unless File.readable?(config_file)
        raise Compass::Error, "Configuration file, #{config_file}, not found or not readable."
      end
      open(config_file) do |f|
        parse_string(f.read, config_file)
      end
    end

get_binding() click to toggle source

    # File lib/compass/configuration/serialization.rb, line 19
    def get_binding
      binding
    end

issue_deprecation_warnings() click to toggle source

    # File lib/compass/configuration/serialization.rb, line 80
    def issue_deprecation_warnings
      if http_images_path == :relative
        $stderr.puts "DEPRECATION WARNING: Please set relative_assets = true to enable relative paths."
      end
    end

parse(config_file) click to toggle source

    # File lib/compass/configuration/serialization.rb, line 5
    def parse(config_file)
      raise Compass::Error, "Compass.configuration.parse(filename) has been removed. Please call Compass.add_project_configuration(filename) instead."
    end

parse_string(contents, filename) click to toggle source

    # File lib/compass/configuration/serialization.rb, line 22
    def parse_string(contents, filename)
      bind = get_binding
      eval(contents, bind, filename)
      local_vars_set = eval("local_variables", bind)
      local_vars_set.each do |local_var|
        if (ATTRIBUTES+ARRAY_ATTRIBUTES).include?(local_var.to_sym)
          value = eval(local_var.to_s, bind)
          value = value.to_s if value.is_a?(Pathname)
          self.send("#{local_var}=", value)
        end
      end
      if @added_import_paths
        self.additional_import_paths ||= []
        self.additional_import_paths += @added_import_paths
        self.additional_import_paths.uniq!
      end
      issue_deprecation_warnings
    end

serialize() click to toggle source

    # File lib/compass/configuration/serialization.rb, line 41
    def serialize
      contents = ""
      (required_libraries || []).each do |lib|
        contents << %{require '#{lib}'\n}
      end
      (loaded_frameworks || []).each do |lib|
        contents << %{load '#{lib}'\n}
      end
      (framework_path || []).each do |lib|
        contents << %{discover '#{lib}'\n}
      end
      contents << "# Require any additional compass plugins here.\n"
      contents << "\n" if (required_libraries || []).any?
      (ATTRIBUTES + ARRAY_ATTRIBUTES).each do |prop|
        value = send("#{prop}_without_default")
        if value.is_a?(Proc)
          $stderr.puts "WARNING: #{prop} is code and cannot be written to a file. You'll need to copy it yourself."
        end
        if respond_to?("comment_for_#{prop}")
          contents << "\n"
          contents << send("comment_for_#{prop}")
        end
        if block_given? && (to_emit = yield(prop, value))
          contents << to_emit
        else
          contents << serialize_property(prop, value) unless value.nil?
        end
      end
      contents
    end

serialize_property(prop, value) click to toggle source

    # File lib/compass/configuration/serialization.rb, line 72
    def serialize_property(prop, value)
      if value.respond_to?(:serialize_to_config)
        value.serialize_to_config(prop) + "\n"
      else
        %(#{prop} = #{value.inspect}\n)
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.