Sha256: 3822830c3f5f430200af8b034c97559dfe1d52b88880437e51f1e5655a86178f

Contents?: true

Size: 1.23 KB

Versions: 143

Compression:

Stored size: 1.23 KB

Contents

module Sass
  module Tree
    # A dynamic node representing a Sass `@warn` statement.
    #
    # @see Sass::Tree
    class WarnNode < Node
      # @param expr [Script::Node] The expression to print
      def initialize(expr)
        @expr = expr
        super()
      end

      protected

      # @see Node#to_src
      def to_src(tabs, opts, fmt)
        "#{'  ' * tabs}@warn #{@expr.to_sass(opts)}#{semi fmt}\n"
      end

      # Prints the expression to STDERR with a stylesheet trace.
      #
      # @param environment [Sass::Environment] The lexical environment containing
      #   variable and mixin values
      def _perform(environment)
        environment.push_frame(:filename => filename, :line => line)
        res = @expr.perform(environment)
        res = res.value if res.is_a?(Sass::Script::String)
        msg = "WARNING: #{res}\n"
        environment.stack.reverse.each_with_index do |entry, i|
          msg << "        #{i == 0 ? "on" : "from"} line #{entry[:line]}" <<
            " of #{entry[:filename] || "an unknown file"}"
          msg << ", in `#{entry[:mixin]}'" if entry[:mixin]
          msg << "\n"
        end
        Haml::Util.haml_warn msg
        []
      ensure
        environment.pop_frame
      end
    end
  end
end

Version data entries

143 entries across 143 versions & 3 rubygems

Version Path
radiant-1.0.0.rc1 vendor/plugins/haml/lib/sass/tree/warn_node.rb
haml-3.0.25 lib/sass/tree/warn_node.rb
haml-3.0.24 lib/sass/tree/warn_node.rb
haml-3.0.23 lib/sass/tree/warn_node.rb
haml-3.0.22 lib/sass/tree/warn_node.rb
haml-3.0.21 lib/sass/tree/warn_node.rb
haml-edge-3.1.79 lib/sass/tree/warn_node.rb
haml-edge-3.1.78 lib/sass/tree/warn_node.rb
haml-edge-3.1.77 lib/sass/tree/warn_node.rb
haml-edge-3.1.76 lib/sass/tree/warn_node.rb
haml-edge-3.1.75 lib/sass/tree/warn_node.rb
haml-edge-3.1.74 lib/sass/tree/warn_node.rb
haml-edge-3.1.73 lib/sass/tree/warn_node.rb
haml-edge-3.1.72 lib/sass/tree/warn_node.rb
haml-edge-3.1.71 lib/sass/tree/warn_node.rb
haml-3.0.18 lib/sass/tree/warn_node.rb
haml-edge-3.1.70 lib/sass/tree/warn_node.rb
haml-edge-3.1.69 lib/sass/tree/warn_node.rb
haml-edge-3.1.68 lib/sass/tree/warn_node.rb
haml-edge-3.1.67 lib/sass/tree/warn_node.rb