Class: Sass::Supports::Declaration

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

Overview

A declaration condition (e.g. (feature: value)).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value) ⇒ Declaration

Returns a new instance of Declaration



157
158
159
160
# File 'lib/sass/supports.rb', line 157

def initialize(name, value)
  @name = name
  @value = value
end

Instance Attribute Details

#nameSass::Script::Tree::Node

Returns The feature name.

Returns:



137
138
139
# File 'lib/sass/supports.rb', line 137

def name
  @name
end

#resolved_nameString

The name of the feature after any SassScript has been resolved. Only set once Tree::Visitors::Perform has been run.

Returns:

  • (String)


144
145
146
# File 'lib/sass/supports.rb', line 144

def resolved_name
  @resolved_name
end

#resolved_valueString

The value of the feature after any SassScript has been resolved. Only set once Tree::Visitors::Perform has been run.

Returns:

  • (String)


155
156
157
# File 'lib/sass/supports.rb', line 155

def resolved_value
  @resolved_value
end

#valueSass::Script::Tree::Node

The feature value.



149
150
151
# File 'lib/sass/supports.rb', line 149

def value
  @value
end

Instance Method Details

#deep_copy



175
176
177
178
179
180
# File 'lib/sass/supports.rb', line 175

def deep_copy
  copy = dup
  copy.name = @name.deep_copy
  copy.value = @value.deep_copy
  copy
end

#options=(options)



182
183
184
185
# File 'lib/sass/supports.rb', line 182

def options=(options)
  @name.options = options
  @value.options = options
end

#perform(env)



162
163
164
165
# File 'lib/sass/supports.rb', line 162

def perform(env)
  @resolved_name = name.perform(env)
  @resolved_value = value.perform(env)
end

#to_css



167
168
169
# File 'lib/sass/supports.rb', line 167

def to_css
  "(#{@resolved_name}: #{@resolved_value})"
end

#to_src(options)



171
172
173
# File 'lib/sass/supports.rb', line 171

def to_src(options)
  "(#{@name.to_sass(options)}: #{@value.to_sass(options)})"
end