Class: Sass::Stack::Frame

Inherits:
Object
  • Object
show all
Defined in:
lib/sass/stack.rb

Overview

A single stack frame.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#filenameString (readonly)

The filename of the file in which this stack frame was created.

Returns:

  • (String)


11
12
13
# File 'lib/sass/stack.rb', line 11

def filename
  @filename
end

#lineString (readonly)

The line number on which this stack frame was created.

Returns:

  • (String)


16
17
18
# File 'lib/sass/stack.rb', line 16

def line
  @line
end

#nameString? (readonly)

The name of the stack frame. For mixin frames, this is the mixin name; otherwise, it's nil.

Returns:

  • (String?)


33
34
35
# File 'lib/sass/stack.rb', line 33

def name
  @name
end

#typeSymbol? (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.

Returns:

  • (Symbol?)


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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


52
53
54
# File 'lib/sass/stack.rb', line 52

def is_mixin?
  type == :mixin
end