sassc 1.8.5 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/sassc/native/native_functions_api.rb +6 -0
- data/lib/sassc/script.rb +4 -0
- data/lib/sassc/script/value_conversion.rb +8 -0
- data/lib/sassc/script/value_conversion/bool.rb +11 -0
- data/lib/sassc/version.rb +1 -1
- data/test/functions_test.rb +25 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4aafee4a5710a8ea851a5702e8a0cc565072af21
|
4
|
+
data.tar.gz: 1971d63aab1fabbbf3354dcf3f4c722c37884e43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da80b6d5c99d360c2a015b30a26758eb58823e44082532b058c159e36f0bffa2b5b0ebc95da828274874e1ed6182b9d9b2cfbff27cc22cc9d1c8b9a9c3523743
|
7
|
+
data.tar.gz: 3f8022f8d73ea4ab6cced6b8bcb7c39a47ae1039c2919777d27f9bce7e7a9af763834bd05196c40fe1c5322c6ea5523d99836c062e72fa6a41604fa0d963adb7
|
data/README.md
CHANGED
@@ -26,6 +26,9 @@ module SassC
|
|
26
26
|
|
27
27
|
# ADDAPI union Sass_Value* ADDCALL sass_make_map (size_t len);
|
28
28
|
attach_function :sass_make_map, [:size_t], :sass_value_ptr
|
29
|
+
|
30
|
+
# ADDAPI union Sass_Value* ADDCALL sass_make_boolean (boolean val);
|
31
|
+
attach_function :sass_make_boolean, [:bool], :sass_value_ptr
|
29
32
|
|
30
33
|
# ADDAPI void ADDCALL sass_map_set_key (union Sass_Value* v, size_t i, union Sass_Value*);
|
31
34
|
attach_function :sass_map_set_key, [:sass_value_ptr, :size_t, :sass_value_ptr], :void
|
@@ -60,6 +63,9 @@ module SassC
|
|
60
63
|
|
61
64
|
# ADDAPI const char* ADDCALL sass_number_get_unit (const union Sass_Value* v);
|
62
65
|
attach_function :sass_number_get_unit, [:sass_value_ptr], :string
|
66
|
+
|
67
|
+
# ADDAPI const char* ADDCALL sass_boolean_get_value (const union Sass_Value* v);
|
68
|
+
attach_function :sass_boolean_get_value, [:sass_value_ptr], :bool
|
63
69
|
|
64
70
|
def self.string_get_type(native_value)
|
65
71
|
string_is_quoted(native_value) ? :string : :identifier
|
data/lib/sassc/script.rb
CHANGED
@@ -31,9 +31,13 @@ require 'sass/util'
|
|
31
31
|
require 'sass/script/value/base'
|
32
32
|
require 'sass/script/value/string'
|
33
33
|
require 'sass/script/value/color'
|
34
|
+
require 'sass/script/value/bool'
|
34
35
|
|
35
36
|
SassC::Script::String = Sass::Script::Value::String
|
36
37
|
SassC::Script::Value::String = Sass::Script::Value::String
|
37
38
|
|
38
39
|
SassC::Script::Color = Sass::Script::Value::Color
|
39
40
|
SassC::Script::Value::Color = Sass::Script::Value::Color
|
41
|
+
|
42
|
+
SassC::Script::Bool = Sass::Script::Value::Bool
|
43
|
+
SassC::Script::Value::Bool = Sass::Script::Value::Bool
|
@@ -10,6 +10,11 @@ module SassC
|
|
10
10
|
type = Native.string_get_type(native_value)
|
11
11
|
argument = Script::String.new(value, type)
|
12
12
|
|
13
|
+
argument
|
14
|
+
when :sass_boolean
|
15
|
+
value = Native.boolean_get_value(native_value)
|
16
|
+
argument = Script::Bool.new(value)
|
17
|
+
|
13
18
|
argument
|
14
19
|
when :sass_number
|
15
20
|
value = Native.number_get_value(native_value)
|
@@ -51,6 +56,8 @@ module SassC
|
|
51
56
|
Number.new(value).to_native
|
52
57
|
when "Map"
|
53
58
|
Map.new(value).to_native
|
59
|
+
when "Bool"
|
60
|
+
Bool.new(value).to_native
|
54
61
|
else
|
55
62
|
raise UnsupportedValue.new("Sass return type #{value_name} unsupported")
|
56
63
|
end
|
@@ -64,3 +71,4 @@ require_relative "value_conversion/string"
|
|
64
71
|
require_relative "value_conversion/number"
|
65
72
|
require_relative "value_conversion/color"
|
66
73
|
require_relative "value_conversion/map"
|
74
|
+
require_relative "value_conversion/bool"
|
data/lib/sassc/version.rb
CHANGED
data/test/functions_test.rb
CHANGED
@@ -80,6 +80,22 @@ module SassC
|
|
80
80
|
CSS
|
81
81
|
end
|
82
82
|
|
83
|
+
def test_function_that_returns_a_bool
|
84
|
+
assert_sass <<-SCSS, <<-CSS
|
85
|
+
div { width: returns-a-bool(); }
|
86
|
+
SCSS
|
87
|
+
div { width: true; }
|
88
|
+
CSS
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_function_that_takes_a_bool
|
92
|
+
assert_sass <<-SCSS, <<-CSS
|
93
|
+
div { display: inspect-bool(true)}
|
94
|
+
SCSS
|
95
|
+
div { display: true; }
|
96
|
+
CSS
|
97
|
+
end
|
98
|
+
|
83
99
|
def test_function_with_optional_arguments
|
84
100
|
assert_sass <<-SCSS, <<-EXPECTED_CSS
|
85
101
|
div {
|
@@ -199,6 +215,15 @@ module SassC
|
|
199
215
|
return Sass::Script::Value::Number.new(-312,'rem')
|
200
216
|
end
|
201
217
|
|
218
|
+
def returns_a_bool
|
219
|
+
return Sass::Script::Value::Bool.new(true)
|
220
|
+
end
|
221
|
+
|
222
|
+
def inspect_bool ( argument )
|
223
|
+
raise StandardError.new "passed value is not a Sass::Script::Value::Bool" unless argument.is_a? Sass::Script::Value::Bool
|
224
|
+
return argument
|
225
|
+
end
|
226
|
+
|
202
227
|
def inspect_number ( argument )
|
203
228
|
raise StandardError.new "passed value is not a Sass::Script::Value::Number" unless argument.is_a? Sass::Script::Value::Number
|
204
229
|
return argument
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sassc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Boland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -345,6 +345,7 @@ files:
|
|
345
345
|
- lib/sassc/script/functions.rb
|
346
346
|
- lib/sassc/script/value_conversion.rb
|
347
347
|
- lib/sassc/script/value_conversion/base.rb
|
348
|
+
- lib/sassc/script/value_conversion/bool.rb
|
348
349
|
- lib/sassc/script/value_conversion/color.rb
|
349
350
|
- lib/sassc/script/value_conversion/map.rb
|
350
351
|
- lib/sassc/script/value_conversion/number.rb
|