From 50ca36619e8ef19b25c0b0d482ffabcfc89ecdb9 Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Sun, 26 Apr 2009 01:32:57 -0700 Subject: [PATCH] [Sass] Convert Sass::Environment docs to YARD. We need to add a special YARD handler for some metaprogramming. --- Rakefile | 1 + lib/sass/environment.rb | 61 +++++++++++++++++++++++++++++++---------- yard/inherited_hash.rb | 44 +++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 14 deletions(-) create mode 100644 yard/inherited_hash.rb diff --git a/Rakefile b/Rakefile index 3edb8bf1..f9a8ac80 100644 --- a/Rakefile +++ b/Rakefile @@ -101,6 +101,7 @@ begin t.files = files.to_a t.options << '-r' << 'README.md' << '-m' << 'maruku' << '--protected' + t.options += FileList.new('yard/*.rb').to_a.map {|f| ['-e', f]}.flatten end task :doc => :yardoc diff --git a/lib/sass/environment.rb b/lib/sass/environment.rb index d38574ed..b9653a98 100644 --- a/lib/sass/environment.rb +++ b/lib/sass/environment.rb @@ -1,7 +1,25 @@ module Sass + # The lexical environment for SassScript. + # This keeps track of variable and mixin definitions. + # + # A new environment is created for each level of Sass nesting. + # This allows variables to be lexically scoped. + # The new environment refers to the environment in the upper scope, + # so it has access to variables defined in enclosing scopes, + # but new variables are defined locally. + # + # Environment also keeps track of the {Engine} options + # so that they can be made available to {Sass::Functions}. class Environment + # The enclosing environment, + # or nil if this is the global environment. + # + # @return [Environment] attr_reader :parent + # @param parent [Environment] See \{#parent} + # @param options [Hash] An options hash; + # see [the Sass options documentation](../Sass.html#sass_options) def initialize(parent = nil, options = nil) @vars = {} @mixins = {} @@ -9,30 +27,45 @@ module Sass @options = options end + # The options hash. + # See [the Sass options documentation](../Sass.html#sass_options). + # + # @return [Hash] def options @options || (parent && parent.options) || {} end - def self.inherited_hash(name) - class_eval <