Class: Sass::Stack
- Inherits:
-
Object
- Object
- Sass::Stack
- Defined in:
- .ruby-sass/lib/sass/stack.rb
Overview
A class representing the stack when compiling a Sass file.
Defined Under Namespace
Classes: Frame
Instance Attribute Summary (collapse)
-
#frames ⇒ Array<Frame>
readonly
The stack frames.
Instance Method Summary (collapse)
-
#initialize ⇒ Stack
constructor
A new instance of Stack.
- #to_s ⇒ Object
-
#with_base(filename, line) { ... } ⇒ Object
Pushes a base frame onto the stack.
-
#with_directive(filename, line, name) { ... } ⇒ Object
Pushes a function frame onto the stack.
-
#with_function(filename, line, name) { ... } ⇒ Object
Pushes a function frame onto the stack.
-
#with_import(filename, line) { ... } ⇒ Object
Pushes an import frame onto the stack.
-
#with_mixin(filename, line, name) { ... } ⇒ Object
Pushes a mixin frame onto the stack.
Constructor Details
#initialize ⇒ Stack
Returns a new instance of Stack
69 70 71 |
# File '.ruby-sass/lib/sass/stack.rb', line 69 def initialize @frames = [] end |
Constructor Details
#initialize ⇒ Stack
Returns a new instance of Stack
69 70 71 |
# File '.ruby-sass/lib/sass/stack.rb', line 69 def initialize @frames = [] end |
Instance Attribute Details
#frames ⇒ Array<Frame> (readonly)
The stack frames. The last frame is the most deeply-nested.
67 68 69 |
# File '.ruby-sass/lib/sass/stack.rb', line 67 def frames @frames end |
Instance Method Details
#to_s ⇒ Object
121 122 123 124 125 126 127 128 |
# File '.ruby-sass/lib/sass/stack.rb', line 121 def to_s (frames.reverse + [nil]).each_cons(2).each_with_index. map do |(frame, caller), i| "#{i == 0 ? 'on' : 'from'} line #{frame.line}" + " of #{frame.filename || 'an unknown file'}" + (caller && caller.name ? ", in `#{caller.name}'" : "") end.join("\n") end |
#with_base(filename, line) { ... } ⇒ Object
Pushes a base frame onto the stack.
78 79 80 |
# File '.ruby-sass/lib/sass/stack.rb', line 78 def with_base(filename, line) with_frame(filename, line, :base) {yield} end |
#with_directive(filename, line, name) { ... } ⇒ Object
Pushes a function frame onto the stack.
117 118 119 |
# File '.ruby-sass/lib/sass/stack.rb', line 117 def with_directive(filename, line, name) with_frame(filename, line, :directive, name) {yield} end |
#with_function(filename, line, name) { ... } ⇒ Object
Pushes a function frame onto the stack.
107 108 109 |
# File '.ruby-sass/lib/sass/stack.rb', line 107 def with_function(filename, line, name) with_frame(filename, line, :function, name) {yield} end |
#with_import(filename, line) { ... } ⇒ Object
Pushes an import frame onto the stack.
87 88 89 |
# File '.ruby-sass/lib/sass/stack.rb', line 87 def with_import(filename, line) with_frame(filename, line, :import) {yield} end |
#with_mixin(filename, line, name) { ... } ⇒ Object
Pushes a mixin frame onto the stack.
97 98 99 |
# File '.ruby-sass/lib/sass/stack.rb', line 97 def with_mixin(filename, line, name) with_frame(filename, line, :mixin, name) {yield} end |