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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ab6f4c497bb370c122244297018added959a8af8
4
- data.tar.gz: ad910a4be141fd033b143c1723f7a8dfef523243
3
+ metadata.gz: 4aafee4a5710a8ea851a5702e8a0cc565072af21
4
+ data.tar.gz: 1971d63aab1fabbbf3354dcf3f4c722c37884e43
5
5
  SHA512:
6
- metadata.gz: 1cd8b55db12f25fca765171af3e7ae3f11702e39a0df778009088dc254777ee90bd138467ef4efcbc865e507c096ce165f3dcd8abae3bfe925eec9e084eaa83d
7
- data.tar.gz: 45205737303fbaca70c190457d30d234eec1c814bd279810bac275a7360c09a59f8f1a0552c6321b658023d986f5e6d4fb7887d8682bcbc45fbdbf1ea685e310
6
+ metadata.gz: da80b6d5c99d360c2a015b30a26758eb58823e44082532b058c159e36f0bffa2b5b0ebc95da828274874e1ed6182b9d9b2cfbff27cc22cc9d1c8b9a9c3523743
7
+ data.tar.gz: 3f8022f8d73ea4ab6cced6b8bcb7c39a47ae1039c2919777d27f9bce7e7a9af763834bd05196c40fe1c5322c6ea5523d99836c062e72fa6a41604fa0d963adb7
data/README.md CHANGED
@@ -25,6 +25,8 @@ and [awesome contributors](https://github.com/bolandrm/sassc-ruby/graphs/contrib
25
25
 
26
26
  ## Changelog
27
27
 
28
+ - **1.9.0**
29
+ Support boolean script support
28
30
  - **1.8.5**
29
31
  - Update to Libsass 3.3.4
30
32
  - **1.8.4**
@@ -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
@@ -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"
@@ -0,0 +1,11 @@
1
+ module SassC
2
+ module Script
3
+ module ValueConversion
4
+ class Bool < Base
5
+ def to_native
6
+ Native::make_boolean(@value.value)
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module SassC
2
- VERSION = "1.8.5"
2
+ VERSION = "1.9.0"
3
3
  end
@@ -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.8.5
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-21 00:00:00.000000000 Z
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