class 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