sassc 1.12.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +61 -0
- data/Gemfile +1 -3
- data/LICENSE.txt +1 -1
- data/README.md +3 -59
- data/lib/sassc.rb +20 -1
- data/lib/sassc/dependency.rb +2 -0
- data/lib/sassc/engine.rb +2 -0
- data/lib/sassc/error.rb +9 -3
- data/lib/sassc/functions_handler.rb +3 -2
- data/lib/sassc/import_handler.rb +2 -0
- data/lib/sassc/importer.rb +2 -0
- data/lib/sassc/native.rb +3 -2
- data/lib/sassc/native/lib_c.rb +2 -0
- data/lib/sassc/native/native_context_api.rb +2 -0
- data/lib/sassc/native/native_functions_api.rb +2 -0
- data/lib/sassc/native/sass2scss_api.rb +2 -0
- data/lib/sassc/native/sass_input_style.rb +2 -0
- data/lib/sassc/native/sass_output_style.rb +2 -0
- data/lib/sassc/native/sass_value.rb +2 -0
- data/lib/sassc/native/string_list.rb +2 -0
- data/lib/sassc/sass_2_scss.rb +2 -0
- data/lib/sassc/script.rb +5 -35
- data/lib/sassc/script/functions.rb +2 -0
- data/lib/sassc/script/value.rb +137 -0
- data/lib/sassc/script/value/bool.rb +32 -0
- data/lib/sassc/script/value/color.rb +95 -0
- data/lib/sassc/script/value/list.rb +136 -0
- data/lib/sassc/script/value/map.rb +69 -0
- data/lib/sassc/script/value/number.rb +389 -0
- data/lib/sassc/script/value/string.rb +96 -0
- data/lib/sassc/script/value_conversion.rb +62 -82
- data/lib/sassc/script/value_conversion/base.rb +2 -0
- data/lib/sassc/script/value_conversion/bool.rb +2 -0
- data/lib/sassc/script/value_conversion/color.rb +2 -0
- data/lib/sassc/script/value_conversion/list.rb +2 -0
- data/lib/sassc/script/value_conversion/map.rb +2 -0
- data/lib/sassc/script/value_conversion/number.rb +2 -0
- data/lib/sassc/script/value_conversion/string.rb +2 -0
- data/lib/sassc/util.rb +231 -0
- data/lib/sassc/util/normalized_map.rb +117 -0
- data/lib/sassc/version.rb +3 -1
- data/lib/tasks/libsass.rb +2 -0
- data/sassc.gemspec +9 -5
- data/test/custom_importer_test.rb +2 -0
- data/test/engine_test.rb +5 -3
- data/test/error_test.rb +2 -0
- data/test/functions_test.rb +31 -37
- data/test/native_test.rb +2 -4
- data/test/output_style_test.rb +2 -0
- data/test/sass_2_scss_test.rb +2 -0
- data/test/test_helper.rb +2 -0
- metadata +23 -29
- data/lib/sassc/cache_stores.rb +0 -6
- data/lib/sassc/cache_stores/base.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 728b06267e365e493048b5367d344608392997c5beee20e7606d763b655514e7
|
4
|
+
data.tar.gz: c418fc06a5d8badec39fe2abf134c8297fa7d96679fa3af145f9718004b3e35b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37937f49272650f5efc95eda412f8487050171a6fe31eae775cdf6ff03aa293458388a22a352a5dd59f3f4141d83a7f32f91b571513cdb14468a11f6176b69ea
|
7
|
+
data.tar.gz: e25e7d5a7b9049802c35e456cb35e22c801028ca93c5efceaea1e7cf80c14ba84ec3ceb7660d6323146cc5b09a9fb8e1843aa678bc3076d2231cf48d84bae197
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
- **2.0.0**
|
2
|
+
- [Remove dependency on Ruby Sass](https://github.com/sass/sassc-ruby/pull/85)
|
3
|
+
- [frozen_string_literal all files](https://github.com/sass/sassc-ruby/pull/85)
|
4
|
+
- **1.12.1**
|
5
|
+
- [Downgrade to libsass 3.5.2 to fix css imports](https://github.com/sass/sassc-ruby/pull/81)
|
6
|
+
- **1.12.0**
|
7
|
+
- [Update Libsass to 3.5.4](https://github.com/sass/sassc-ruby/pull/78)
|
8
|
+
- [bundler is a development dependency](https://github.com/sass/sassc-ruby/pull/51)
|
9
|
+
- **1.11.4**
|
10
|
+
- Fix `Value::List` related issue with sass 3.5.0
|
11
|
+
- **1.11.3**
|
12
|
+
- [Require Sass::Deprecation module](https://github.com/sass/sassc-ruby/pull/68)
|
13
|
+
- **1.11.2**
|
14
|
+
- [Update to libsass 3.4.3](https://github.com/sass/sassc-ruby/pull/65)
|
15
|
+
- **1.11.1**
|
16
|
+
- [Update to libsass 3.4.1](https://github.com/sass/sassc-ruby/pull/61)
|
17
|
+
- **1.11.0**
|
18
|
+
- [Add support for lists in functions](https://github.com/sass/sassc-ruby/pull/55)
|
19
|
+
- [Update to libsass 3.4.0](https://github.com/sass/sassc-ruby/pull/57)
|
20
|
+
- **1.10.1**
|
21
|
+
- [Add sourcemap getter](https://github.com/sass/sassc-ruby/pull/48)
|
22
|
+
- **1.10.0**
|
23
|
+
- [Improved error messages](https://github.com/sass/sassc-ruby/pull/34)
|
24
|
+
- Update to Libsass 3.3.6
|
25
|
+
- **1.9.0**
|
26
|
+
- Support boolean script support
|
27
|
+
- **1.8.5**
|
28
|
+
- Update to Libsass 3.3.4
|
29
|
+
- **1.8.4**
|
30
|
+
- Update to Libsass 3.3.3
|
31
|
+
- **1.8.3**
|
32
|
+
- [Passing empty string into engine does not raise error](https://github.com/sass/sassc-ruby/pull/31)
|
33
|
+
- **1.8.2**
|
34
|
+
- Update to Libsass 3.3.2
|
35
|
+
- **1.8.1**
|
36
|
+
- Update to Libsass 3.3.1
|
37
|
+
- **1.8.0**
|
38
|
+
- Update to Libsass 3.3.0
|
39
|
+
- **1.8.0.pre2**
|
40
|
+
- Fix bug with looking up gem_path
|
41
|
+
- **1.8.0.pre1**
|
42
|
+
- [Update to Libsass 3.3.0-beta3](https://github.com/sass/sassc-ruby/pull/20)
|
43
|
+
- **1.7.1**
|
44
|
+
- Some updates to `Engine` API.
|
45
|
+
- **1.7.0**
|
46
|
+
- [Support Precision](https://github.com/sass/sassc-ruby/pull/19)
|
47
|
+
- **1.6.0**
|
48
|
+
- [Support Sass Color types](https://github.com/bolandrm/sassc-ruby/pull/14)
|
49
|
+
- [Support quoted strings](https://github.com/bolandrm/sassc-ruby/pull/13)
|
50
|
+
- [Improve custom function error handling](https://github.com/bolandrm/sassc-ruby/pull/15)
|
51
|
+
- **1.5.1**
|
52
|
+
- 2nd attempt at fixing compilation bug (issue [#12](https://github.com/bolandrm/sassc-ruby/issues/12))
|
53
|
+
- **1.5.0**
|
54
|
+
- Add support for inline source maps
|
55
|
+
- Fix compilation bug (issue [#12](https://github.com/bolandrm/sassc-ruby/issues/12))
|
56
|
+
- **1.4.0**
|
57
|
+
- Add support for line number comments
|
58
|
+
- **1.3.0**
|
59
|
+
- Support Sass color custom function arguments
|
60
|
+
- Adds error handling for exceptions in custom functions
|
61
|
+
- Custom functions may have optional/default arguments
|
data/Gemfile
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Use `libsass` with Ruby!
|
4
4
|
|
5
|
-
This gem combines the speed of `libsass`, the [Sass C implementation](https://github.com/sass/libsass), with the ease of use of the original [Ruby Sass](https://github.com/sass/sass) library.
|
5
|
+
This gem combines the speed of `libsass`, the [Sass C implementation](https://github.com/sass/libsass), with the ease of use of the original [Ruby Sass](https://github.com/sass/ruby-sass) library.
|
6
6
|
|
7
7
|
### libsass Version
|
8
8
|
|
@@ -48,64 +48,8 @@ This gem is maintained by [Ryan Boland](https://ryanboland.com)
|
|
48
48
|
and [awesome contributors](https://github.com/bolandrm/sassc-ruby/graphs/contributors).
|
49
49
|
|
50
50
|
## Changelog
|
51
|
-
|
52
|
-
|
53
|
-
- **1.12.0**
|
54
|
-
- [Update Libsass to 3.5.4](https://github.com/sass/sassc-ruby/pull/78)
|
55
|
-
- [bundler is a development dependency](https://github.com/sass/sassc-ruby/pull/51)
|
56
|
-
- **1.11.4**
|
57
|
-
- Fix `Value::List` related issue with sass 3.5.0
|
58
|
-
- **1.11.3**
|
59
|
-
- [Require Sass::Deprecation module](https://github.com/sass/sassc-ruby/pull/68)
|
60
|
-
- **1.11.2**
|
61
|
-
- [Update to libsass 3.4.3](https://github.com/sass/sassc-ruby/pull/65)
|
62
|
-
- **1.11.1**
|
63
|
-
- [Update to libsass 3.4.1](https://github.com/sass/sassc-ruby/pull/61)
|
64
|
-
- **1.11.0**
|
65
|
-
- [Add support for lists in functions](https://github.com/sass/sassc-ruby/pull/55)
|
66
|
-
- [Update to libsass 3.4.0](https://github.com/sass/sassc-ruby/pull/57)
|
67
|
-
- **1.10.1**
|
68
|
-
- [Add sourcemap getter](https://github.com/sass/sassc-ruby/pull/48)
|
69
|
-
- **1.10.0**
|
70
|
-
- [Improved error messages](https://github.com/sass/sassc-ruby/pull/34)
|
71
|
-
- Update to Libsass 3.3.6
|
72
|
-
- **1.9.0**
|
73
|
-
- Support boolean script support
|
74
|
-
- **1.8.5**
|
75
|
-
- Update to Libsass 3.3.4
|
76
|
-
- **1.8.4**
|
77
|
-
- Update to Libsass 3.3.3
|
78
|
-
- **1.8.3**
|
79
|
-
- [Passing empty string into engine does not raise error](https://github.com/sass/sassc-ruby/pull/31)
|
80
|
-
- **1.8.2**
|
81
|
-
- Update to Libsass 3.3.2
|
82
|
-
- **1.8.1**
|
83
|
-
- Update to Libsass 3.3.1
|
84
|
-
- **1.8.0**
|
85
|
-
- Update to Libsass 3.3.0
|
86
|
-
- **1.8.0.pre2**
|
87
|
-
- Fix bug with looking up gem_path
|
88
|
-
- **1.8.0.pre1**
|
89
|
-
- [Update to Libsass 3.3.0-beta3](https://github.com/sass/sassc-ruby/pull/20)
|
90
|
-
- **1.7.1**
|
91
|
-
- Some updates to `Engine` API.
|
92
|
-
- **1.7.0**
|
93
|
-
- [Support Precision](https://github.com/sass/sassc-ruby/pull/19)
|
94
|
-
- **1.6.0**
|
95
|
-
- [Support Sass Color types](https://github.com/bolandrm/sassc-ruby/pull/14)
|
96
|
-
- [Support quoted strings](https://github.com/bolandrm/sassc-ruby/pull/13)
|
97
|
-
- [Improve custom function error handling](https://github.com/bolandrm/sassc-ruby/pull/15)
|
98
|
-
- **1.5.1**
|
99
|
-
- 2nd attempt at fixing compilation bug (issue [#12](https://github.com/bolandrm/sassc-ruby/issues/12))
|
100
|
-
- **1.5.0**
|
101
|
-
- Add support for inline source maps
|
102
|
-
- Fix compilation bug (issue [#12](https://github.com/bolandrm/sassc-ruby/issues/12))
|
103
|
-
- **1.4.0**
|
104
|
-
- Add support for line number comments
|
105
|
-
- **1.3.0**
|
106
|
-
- Support Sass color custom function arguments
|
107
|
-
- Adds error handling for exceptions in custom functions
|
108
|
-
- Custom functions may have optional/default arguments
|
51
|
+
|
52
|
+
See [CHANGELOG.md](CHANGELOG.md).
|
109
53
|
|
110
54
|
## Contributing
|
111
55
|
|
data/lib/sassc.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SassC
|
2
4
|
end
|
3
5
|
|
@@ -5,9 +7,26 @@ require_relative "sassc/version"
|
|
5
7
|
require_relative "sassc/native"
|
6
8
|
require_relative "sassc/import_handler"
|
7
9
|
require_relative "sassc/importer"
|
10
|
+
require_relative "sassc/util"
|
11
|
+
require_relative "sassc/util/normalized_map"
|
8
12
|
require_relative "sassc/script"
|
13
|
+
require_relative "sassc/script/value"
|
14
|
+
require_relative "sassc/script/value/bool"
|
15
|
+
require_relative "sassc/script/value/number"
|
16
|
+
require_relative "sassc/script/value/color"
|
17
|
+
require_relative "sassc/script/value/string"
|
18
|
+
require_relative "sassc/script/value/list"
|
19
|
+
require_relative "sassc/script/value/map"
|
20
|
+
require_relative "sassc/script/functions"
|
21
|
+
require_relative "sassc/script/value_conversion"
|
22
|
+
require_relative "sassc/script/value_conversion/base"
|
23
|
+
require_relative "sassc/script/value_conversion/string"
|
24
|
+
require_relative "sassc/script/value_conversion/number"
|
25
|
+
require_relative "sassc/script/value_conversion/color"
|
26
|
+
require_relative "sassc/script/value_conversion/map"
|
27
|
+
require_relative "sassc/script/value_conversion/list"
|
28
|
+
require_relative "sassc/script/value_conversion/bool"
|
9
29
|
require_relative "sassc/functions_handler"
|
10
|
-
require_relative "sassc/cache_stores"
|
11
30
|
require_relative "sassc/dependency"
|
12
31
|
require_relative "sassc/error"
|
13
32
|
require_relative "sassc/engine"
|
data/lib/sassc/dependency.rb
CHANGED
data/lib/sassc/engine.rb
CHANGED
data/lib/sassc/error.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "pathname"
|
3
4
|
|
4
5
|
module SassC
|
6
|
+
|
5
7
|
class BaseError < StandardError; end
|
6
8
|
class NotRenderedError < BaseError; end
|
7
9
|
class InvalidStyleError < BaseError; end
|
@@ -9,8 +11,10 @@ module SassC
|
|
9
11
|
|
10
12
|
# When dealing with SyntaxErrors,
|
11
13
|
# it's important to provide filename and line number information.
|
12
|
-
# This will be used in various error reports to users, including backtraces
|
14
|
+
# This will be used in various error reports to users, including backtraces.
|
15
|
+
|
13
16
|
class SyntaxError < BaseError
|
17
|
+
|
14
18
|
def initialize(message, filename: nil, line: nil)
|
15
19
|
@filename = filename
|
16
20
|
@line = line
|
@@ -27,5 +31,7 @@ module SassC
|
|
27
31
|
return [] unless @filename && @line
|
28
32
|
["#{@filename}:#{@line}"]
|
29
33
|
end
|
34
|
+
|
30
35
|
end
|
36
|
+
|
31
37
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SassC
|
2
4
|
class FunctionsHandler
|
3
5
|
def initialize(options)
|
@@ -54,8 +56,7 @@ module SassC
|
|
54
56
|
def to_native_value(sass_value)
|
55
57
|
# if the custom function returns nil, we provide a "default" return
|
56
58
|
# value of an empty string
|
57
|
-
sass_value ||= Script::String.new("")
|
58
|
-
|
59
|
+
sass_value ||= SassC::Script::Value::String.new("")
|
59
60
|
sass_value.options = @options
|
60
61
|
Script::ValueConversion.to_native(sass_value)
|
61
62
|
end
|
data/lib/sassc/import_handler.rb
CHANGED
data/lib/sassc/importer.rb
CHANGED
data/lib/sassc/native.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "ffi"
|
2
4
|
|
3
5
|
module SassC
|
@@ -48,8 +50,7 @@ module SassC
|
|
48
50
|
end
|
49
51
|
|
50
52
|
def self.native_string(string)
|
51
|
-
string = string
|
52
|
-
string << "\0"
|
53
|
+
string = "#{string}\0"
|
53
54
|
data = Native::LibC.malloc(string.bytesize)
|
54
55
|
data.write_string(string)
|
55
56
|
data
|
data/lib/sassc/native/lib_c.rb
CHANGED
data/lib/sassc/sass_2_scss.rb
CHANGED
data/lib/sassc/script.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SassC
|
2
4
|
module Script
|
5
|
+
|
3
6
|
def self.custom_functions
|
4
7
|
Functions.instance_methods.select do |function|
|
5
8
|
Functions.public_method_defined?(function)
|
@@ -8,42 +11,9 @@ module SassC
|
|
8
11
|
|
9
12
|
def self.formatted_function_name(function_name)
|
10
13
|
params = Functions.instance_method(function_name).parameters
|
11
|
-
params = params.map { |param_type, name| "$#{name}#{': null' if param_type == :opt}" }
|
12
|
-
|
13
|
-
|
14
|
-
"#{function_name}(#{params})"
|
15
|
-
end
|
16
|
-
|
17
|
-
module Value
|
14
|
+
params = params.map { |param_type, name| "$#{name}#{': null' if param_type == :opt}" }.join(", ")
|
15
|
+
return "#{function_name}(#{params})"
|
18
16
|
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
require_relative "script/functions"
|
23
|
-
require_relative "script/value_conversion"
|
24
17
|
|
25
|
-
module Sass
|
26
|
-
module Script
|
27
18
|
end
|
28
19
|
end
|
29
|
-
|
30
|
-
require 'sass/util'
|
31
|
-
|
32
|
-
begin
|
33
|
-
require 'sass/deprecation'
|
34
|
-
rescue LoadError
|
35
|
-
end
|
36
|
-
|
37
|
-
require 'sass/script/value/base'
|
38
|
-
require 'sass/script/value/string'
|
39
|
-
require 'sass/script/value/color'
|
40
|
-
require 'sass/script/value/bool'
|
41
|
-
|
42
|
-
SassC::Script::String = Sass::Script::Value::String
|
43
|
-
SassC::Script::Value::String = Sass::Script::Value::String
|
44
|
-
|
45
|
-
SassC::Script::Color = Sass::Script::Value::Color
|
46
|
-
SassC::Script::Value::Color = Sass::Script::Value::Color
|
47
|
-
|
48
|
-
SassC::Script::Bool = Sass::Script::Value::Bool
|
49
|
-
SassC::Script::Value::Bool = Sass::Script::Value::Bool
|
@@ -0,0 +1,137 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The abstract superclass for SassScript objects.
|
4
|
+
# Many of these methods, especially the ones that correspond to SassScript operations,
|
5
|
+
# are designed to be overridden by subclasses which may change the semantics somewhat.
|
6
|
+
# The operations listed here are just the defaults.
|
7
|
+
|
8
|
+
class SassC::Script::Value
|
9
|
+
|
10
|
+
# Returns the pure Ruby value of the value.
|
11
|
+
# The type of this value varies based on the subclass.
|
12
|
+
attr_reader :value
|
13
|
+
|
14
|
+
# The source range in the document on which this node appeared.
|
15
|
+
attr_accessor :source_range
|
16
|
+
|
17
|
+
# Creates a new value.
|
18
|
+
def initialize(value = nil)
|
19
|
+
value.freeze unless value.nil? || value == true || value == false
|
20
|
+
@value = value
|
21
|
+
@options = nil
|
22
|
+
end
|
23
|
+
|
24
|
+
# Sets the options hash for this node,
|
25
|
+
# as well as for all child nodes.
|
26
|
+
# See the official Sass reference for options.
|
27
|
+
attr_writer :options
|
28
|
+
|
29
|
+
# Returns the options hash for this node.
|
30
|
+
# Raises SassC::SyntaxError if the value was created
|
31
|
+
# outside of the parser and \{#to\_s} was called on it
|
32
|
+
def options
|
33
|
+
return @options if @options
|
34
|
+
raise SassC::SyntaxError.new("The #options attribute is not set on this #{self.class}. This error is probably occurring because #to_s was called on this value within a custom Sass function without first setting the #options attribute.")
|
35
|
+
end
|
36
|
+
|
37
|
+
# Returns the hash code of this value. Two objects' hash codes should be
|
38
|
+
# equal if the objects are equal.
|
39
|
+
def hash
|
40
|
+
value.hash
|
41
|
+
end
|
42
|
+
|
43
|
+
# True if this Value is the same as `other`
|
44
|
+
def eql?(other)
|
45
|
+
self == other
|
46
|
+
end
|
47
|
+
|
48
|
+
# Returns a system inspect value for this object
|
49
|
+
def inspect
|
50
|
+
value.inspect
|
51
|
+
end
|
52
|
+
|
53
|
+
# Returns `true` (all Values are truthy)
|
54
|
+
def to_bool
|
55
|
+
true
|
56
|
+
end
|
57
|
+
|
58
|
+
# Compares this object to `other`
|
59
|
+
def ==(other)
|
60
|
+
self.class == other.class && value == other.value
|
61
|
+
end
|
62
|
+
|
63
|
+
# Returns the integer value of this value.
|
64
|
+
# Raises SassC::SyntaxError if this value doesn’t implment integer conversion.
|
65
|
+
def to_i
|
66
|
+
raise SassC::SyntaxError.new("#{inspect} is not an integer.")
|
67
|
+
end
|
68
|
+
|
69
|
+
# @raise [SassC::SyntaxError] if this value isn't an integer
|
70
|
+
def assert_int!; to_i; end
|
71
|
+
|
72
|
+
# Returns the separator for this value. For non-list-like values or the
|
73
|
+
# empty list, this will be `nil`. For lists or maps, it will be `:space` or `:comma`.
|
74
|
+
def separator
|
75
|
+
nil
|
76
|
+
end
|
77
|
+
|
78
|
+
# Whether the value is surrounded by square brackets. For non-list values,
|
79
|
+
# this will be `false`.
|
80
|
+
def bracketed
|
81
|
+
false
|
82
|
+
end
|
83
|
+
|
84
|
+
# Returns the value of this Value as an array.
|
85
|
+
# Single Values are considered the same as single-element arrays.
|
86
|
+
def to_a
|
87
|
+
[self]
|
88
|
+
end
|
89
|
+
|
90
|
+
# Returns the value of this value as a hash. Most values don't have hash
|
91
|
+
# representations, but [Map]s and empty [List]s do.
|
92
|
+
#
|
93
|
+
# @return [Hash<Value, Value>] This value as a hash
|
94
|
+
# @raise [SassC::SyntaxError] if this value doesn't have a hash representation
|
95
|
+
def to_h
|
96
|
+
raise SassC::SyntaxError.new("#{inspect} is not a map.")
|
97
|
+
end
|
98
|
+
|
99
|
+
# Returns the string representation of this value
|
100
|
+
# as it would be output to the CSS document.
|
101
|
+
#
|
102
|
+
# @options opts :quote [String]
|
103
|
+
# The preferred quote style for quoted strings. If `:none`, strings are
|
104
|
+
# always emitted unquoted.
|
105
|
+
# @return [String]
|
106
|
+
def to_s(opts = {})
|
107
|
+
SassC::Util.abstract(self)
|
108
|
+
end
|
109
|
+
alias_method :to_sass, :to_s
|
110
|
+
|
111
|
+
# Returns `false` (all Values are truthy)
|
112
|
+
def null?
|
113
|
+
false
|
114
|
+
end
|
115
|
+
|
116
|
+
# Creates a new list containing `contents` but with the same brackets and
|
117
|
+
# separators as this object, when interpreted as a list.
|
118
|
+
#
|
119
|
+
# @param contents [Array<Value>] The contents of the new list.
|
120
|
+
# @param separator [Symbol] The separator of the new list. Defaults to \{#separator}.
|
121
|
+
# @param bracketed [Boolean] Whether the new list is bracketed. Defaults to \{#bracketed}.
|
122
|
+
# @return [Sass::Script::Value::List]
|
123
|
+
def with_contents(contents, separator: self.separator, bracketed: self.bracketed)
|
124
|
+
SassC::Script::Value::List.new(contents, separator: separator, bracketed: bracketed)
|
125
|
+
end
|
126
|
+
|
127
|
+
protected
|
128
|
+
|
129
|
+
# Evaluates the value.
|
130
|
+
#
|
131
|
+
# @param environment [Sass::Environment] The environment in which to evaluate the SassScript
|
132
|
+
# @return [Value] This value
|
133
|
+
def _perform(environment)
|
134
|
+
self
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|