Class: Sass::Stack::Frame
- Inherits:
-
Object
- Object
- Sass::Stack::Frame
- Defined in:
- lib/sass/stack.rb
Overview
A single stack frame.
Instance Attribute Summary collapse
-
#filename ⇒ String
readonly
The filename of the file in which this stack frame was created.
-
#line ⇒ String
readonly
The line number on which this stack frame was created.
-
#name ⇒ String?
readonly
The name of the stack frame.
-
#type ⇒ Symbol?
readonly
The type of this stack frame.
Instance Method Summary collapse
-
#initialize(filename, line, type, name = nil) ⇒ Frame
constructor
A new instance of Frame.
-
#is_base? ⇒ Boolean
Whether this is the base frame.
-
#is_import? ⇒ Boolean
Whether this frame represents an import.
-
#is_mixin? ⇒ Boolean
Whether this frame represents a mixin.
Constructor Details
#initialize(filename, line, type, name = nil) ⇒ Frame
Returns a new instance of Frame.
35 36 37 38 39 40 |
# File 'lib/sass/stack.rb', line 35
def initialize(filename, line, type, name = nil)
@filename = filename
@line = line
@type = type
@name = name
end
|
Instance Attribute Details
#filename ⇒ String (readonly)
The filename of the file in which this stack frame was created.
11 12 13 |
# File 'lib/sass/stack.rb', line 11
def filename
@filename
end
|
#line ⇒ String (readonly)
The line number on which this stack frame was created.
16 17 18 |
# File 'lib/sass/stack.rb', line 16
def line
@line
end
|
#name ⇒ String? (readonly)
The name of the stack frame. For mixin frames, this is the mixin name;
otherwise, it's nil
.
33 34 35 |
# File 'lib/sass/stack.rb', line 33
def name
@name
end
|
#type ⇒ Symbol? (readonly)
The type of this stack frame. This can be :import
, :mixin
, or
:base
.
:base
indicates that this is the bottom-most frame, meaning that it
represents a single line of code rather than a nested context. The stack
will only ever have one base frame, and it will always be the most
deeply-nested frame.
27 28 29 |
# File 'lib/sass/stack.rb', line 27
def type
@type
end
|
Instance Method Details
#is_base? ⇒ Boolean
Whether this is the base frame.
59 60 61 |
# File 'lib/sass/stack.rb', line 59
def is_base?
type == :base
end
|
#is_import? ⇒ Boolean
Whether this frame represents an import.
45 46 47 |
# File 'lib/sass/stack.rb', line 45
def is_import?
type == :import
end
|
#is_mixin? ⇒ Boolean
Whether this frame represents a mixin.
52 53 54 |
# File 'lib/sass/stack.rb', line 52
def is_mixin?
type == :mixin
end
|