Class: Compass::Stats::SassFile

### Home Classes Methods

### In Files

- lib/compass/stats.rb

### Parent

Object

### Methods

- ::new
- #analyze!
- #contents
- #lines
- #mixin_count
- #mixin_def_count
- #prop_count
- #rule_count
- #tree
- #visit_tree!

### Class/Module Index

Quicksearch

- Compass
- Compass::Actions
- Compass::AppIntegration
- Compass::AppIntegration::Helpers
- Compass::AppIntegration::StandAlone
- Compass::AppIntegration::StandAlone::ConfigurationDefaults
- Compass::AppIntegration::StandAlone::Installer
- 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::Help
- Compass::Commands::HelpOptionsParser
- Compass::Commands::Imports
- Compass::Commands::InstallerCommand
- Compass::Commands::Interactive
- Compass::Commands::InteractiveOptionsParser
- Compass::Commands::ListFrameworks
- 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::WriteConfiguration
- Compass::Compiler
- Compass::Configuration
- Compass::Configuration::Comments
- Compass::Configuration::Data
- Compass::Configuration::FileData
- Compass::Configuration::Helpers
- Compass::Configuration::Serialization
- Compass::Deprecation
- Compass::Exec
- Compass::Exec::CommandOptionParser
- Compass::Exec::GlobalOptionsParser
- Compass::Exec::Helpers
- Compass::Exec::ProjectOptionsParser
- Compass::Exec::SubCommandUI
- Compass::FilesystemConflict
- 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::SassCompiler
- Compass::SassExtensions
- Compass::SassExtensions::Functions
- Compass::SassExtensions::Functions::SassDeclarationHelper
- Compass::SassExtensions::Functions::Sprites
- Compass::SassExtensions::Functions::Sprites::VariableReader
- 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::Images
- Compass::SassExtensions::Sprites::Layout
- Compass::SassExtensions::Sprites::Layout::Diagonal
- Compass::SassExtensions::Sprites::Layout::Horizontal
- Compass::SassExtensions::Sprites::Layout::Smart
- Compass::SassExtensions::Sprites::Layout::SpriteLayout
- Compass::SassExtensions::Sprites::Layout::Vertical
- 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::Version
- Sass
- Sass::Script
- Sass::Script::Functions
- QuickCache

No matching classes.

# Compass::Stats::SassFile

### Attributes

file_size[RW]
path[RW]
visitor[R]

### Public Class Methods

new(path) click to toggle source

    # File lib/compass/stats.rb, line 62
    def initialize(path)
      self.path = path
    end

### Public Instance Methods

analyze!() click to toggle source

    # File lib/compass/stats.rb, line 78
    def analyze!
      self.file_size = File.size(path)
      visit_tree!
    end

contents() click to toggle source

    # File lib/compass/stats.rb, line 65
    def contents
      @contents ||= File.read(path)
    end

lines() click to toggle source

    # File lib/compass/stats.rb, line 82
    def lines
      contents.inject(0){|m,c| m + 1 }
    end

mixin_count() click to toggle source

    # File lib/compass/stats.rb, line 94
    def mixin_count
      visitor.mixin_count
    end

mixin_def_count() click to toggle source

    # File lib/compass/stats.rb, line 91
    def mixin_def_count
      visitor.mixin_def_count
    end

prop_count() click to toggle source

    # File lib/compass/stats.rb, line 88
    def prop_count
      visitor.prop_count
    end

rule_count() click to toggle source

    # File lib/compass/stats.rb, line 85
    def rule_count
      visitor.rule_count
    end

tree() click to toggle source

    # File lib/compass/stats.rb, line 68
    def tree
      opts = Compass.configuration.to_sass_engine_options
      opts[:syntax] = path[-4..-1].to_sym
      @tree = Sass::Engine.new(contents, opts).to_tree
    end

visit_tree!() click to toggle source

    # File lib/compass/stats.rb, line 73
    def visit_tree!
      @visitor = StatsVisitor.new
      tree.visit_depth_first(@visitor)
      @visitor
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.