sass 3.1.3 → 3.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.1.3
1
+ 3.1.4
@@ -42,15 +42,20 @@ module Sass
42
42
  raise "#{self.class} must implement #_retrieve."
43
43
  end
44
44
 
45
- # Store a {Sass::Tree::RootNode}.
45
+ # Store an object to the Sass Cache.
46
46
  #
47
47
  # @param key [String] The key to store it under.
48
48
  # @param sha [String] The checksum for the contents that are being stored.
49
49
  # @param obj [Object] The object to cache.
50
- def store(key, sha, root)
51
- _store(key, Sass::VERSION, sha, Marshal.dump(root))
50
+ def store(key, sha, obj)
51
+ temp = obj.before_sass_cache_store if obj.respond_to?(:before_sass_cache_store)
52
+ begin
53
+ _store(key, Sass::VERSION, sha, Marshal.dump(obj))
54
+ ensure
55
+ obj.after_sass_cache_store(temp) if obj.respond_to?(:after_sass_cache_store)
56
+ end
52
57
  rescue TypeError, LoadError => e
53
- Sass::Util.sass_warn "Warning. Error encountered while saving cache #{path_to(key)}: #{e}"
58
+ Sass::Util.sass_warn "Warning. Error encountered while saving a #{obj.class.name} to cache #{path_to(key)}: #{e}"
54
59
  end
55
60
 
56
61
  # Retrieve a {Sass::Tree::RootNode}.
@@ -8,6 +8,11 @@ module Sass
8
8
  # @return [Script::Node]
9
9
  attr_reader :expr
10
10
 
11
+ # Returns sub nodes that are not tree children.
12
+ def subnodes
13
+ Array(expr)
14
+ end
15
+
11
16
  # @param expr [Script::Node] The expression to print
12
17
  def initialize(expr)
13
18
  @expr = expr
@@ -20,5 +20,11 @@ module Sass::Tree
20
20
  @list = list
21
21
  super()
22
22
  end
23
+
24
+ # Returns sub nodes that are not tree children.
25
+ def subnodes
26
+ Array(list)
27
+ end
28
+
23
29
  end
24
30
  end
@@ -32,5 +32,10 @@ module Sass::Tree
32
32
  @exclusive = exclusive
33
33
  super()
34
34
  end
35
+
36
+ # Returns sub nodes that are not tree children.
37
+ def subnodes
38
+ Array(from) + Array(to)
39
+ end
35
40
  end
36
41
  end
@@ -22,6 +22,11 @@ module Sass
22
22
  @args = args
23
23
  super()
24
24
  end
25
+
26
+ # Returns sub nodes that are not tree children.
27
+ def subnodes
28
+ Array(args)
29
+ end
25
30
  end
26
31
  end
27
32
  end
@@ -61,5 +61,10 @@ module Sass::Tree
61
61
  node.else = self.else.deep_copy if self.else
62
62
  node
63
63
  end
64
+
65
+ # Returns sub nodes that are not tree children.
66
+ def subnodes
67
+ Array(expr) + Array(self.else)
68
+ end
64
69
  end
65
70
  end
@@ -22,6 +22,11 @@ module Sass
22
22
  @args = args
23
23
  super()
24
24
  end
25
+
26
+ # Returns sub nodes that are not tree children.
27
+ def subnodes
28
+ Array(args)
29
+ end
25
30
  end
26
31
  end
27
32
  end
@@ -28,5 +28,10 @@ module Sass::Tree
28
28
  @keywords = keywords
29
29
  super()
30
30
  end
31
+
32
+ # Returns sub nodes that are not tree children.
33
+ def subnodes
34
+ Array(args) + (keywords||{}).values
35
+ end
31
36
  end
32
37
  end
@@ -66,6 +66,9 @@ module Sass
66
66
  # @see #options
67
67
  def options=(options)
68
68
  children.each {|c| c.options = options}
69
+ if respond_to?(:subnodes)
70
+ subnodes.each {|n| n.options = options if n.respond_to?(:options=)}
71
+ end
69
72
  @options = options
70
73
  end
71
74
 
@@ -190,6 +193,16 @@ module Sass
190
193
  node
191
194
  end
192
195
 
196
+ def before_sass_cache_store
197
+ o = self.options
198
+ self.options = {}
199
+ return o
200
+ end
201
+
202
+ def after_sass_cache_store(o)
203
+ self.options = o
204
+ end
205
+
193
206
  protected
194
207
 
195
208
  # @see Sass::Shared.balance
@@ -55,6 +55,11 @@ module Sass::Tree
55
55
  super()
56
56
  end
57
57
 
58
+ # Returns sub nodes that are not tree children.
59
+ def subnodes
60
+ Array(name).select{|n| n.is_a?(Sass::Script::Node)} + [value]
61
+ end
62
+
58
63
  # Compares the names and values of two properties.
59
64
  #
60
65
  # @param other [Object] The object to compare with
@@ -13,6 +13,11 @@ module Sass
13
13
  @expr = expr
14
14
  super()
15
15
  end
16
+
17
+ # Returns sub nodes that are not tree children.
18
+ def subnodes
19
+ Array(expr)
20
+ end
16
21
  end
17
22
  end
18
23
  end
@@ -115,6 +115,11 @@ module Sass::Tree
115
115
  :line => self.line}
116
116
  end
117
117
 
118
+ # Returns sub nodes that are not tree children.
119
+ def subnodes
120
+ rule.select{|r| r.is_a?(Sass::Script::Node)}
121
+ end
122
+
118
123
  private
119
124
 
120
125
  def try_to_parse_non_interpolated_rules
@@ -25,6 +25,12 @@ module Sass
25
25
  @guarded = guarded
26
26
  super()
27
27
  end
28
+
29
+ # Returns sub nodes that are not tree children.
30
+ def subnodes
31
+ Array(expr)
32
+ end
33
+
28
34
  end
29
35
  end
30
36
  end
@@ -13,6 +13,12 @@ module Sass
13
13
  @expr = expr
14
14
  super()
15
15
  end
16
+
17
+ # Returns sub nodes that are not tree children.
18
+ def subnodes
19
+ Array(expr)
20
+ end
21
+
16
22
  end
17
23
  end
18
24
  end
@@ -14,5 +14,11 @@ module Sass::Tree
14
14
  @expr = expr
15
15
  super()
16
16
  end
17
+
18
+ # Returns sub nodes that are not tree children.
19
+ def subnodes
20
+ Array(expr)
21
+ end
22
+
17
23
  end
18
24
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: sass
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 3.1.3
5
+ version: 3.1.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Nathan Weizenbaum
@@ -12,7 +12,7 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2011-06-19 00:00:00 -07:00
15
+ date: 2011-07-02 00:00:00 -07:00
16
16
  default_executable:
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency