sass 3.1.0.alpha.37 → 3.1.0.alpha.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- 3.1.0.alpha.37
1
+ 3.1.0.alpha.38
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.1.0.alpha.37
1
+ 3.1.0.alpha.38
@@ -24,11 +24,21 @@ module Sass
24
24
  # The locations and frequency {file:SASS_REFERENCE.md#options can be customized}.
25
25
  # That's all there is to it!
26
26
  class Rack
27
+ # The delay, in seconds, between update checks.
28
+ # Useful when many resources are requested for a single page.
29
+ # `nil` means no delay at all.
30
+ #
31
+ # @return [Float]
32
+ attr_accessor :dwell
33
+
27
34
  # Initialize the middleware.
28
35
  #
29
36
  # @param app [#call] The Rack application
30
- def initialize(app)
37
+ # @param dwell [Float] See \{#dwell}
38
+ def initialize(app, dwell = 1.0)
31
39
  @app = app
40
+ @dwell = dwell
41
+ @check_after = Time.now.to_f
32
42
  end
33
43
 
34
44
  # Process a request, checking the Sass stylesheets for changes
@@ -37,7 +47,10 @@ module Sass
37
47
  # @param env The Rack request environment
38
48
  # @return [(#to_i, {String => String}, Object)] The Rack response
39
49
  def call(env)
40
- Sass::Plugin.check_for_updates
50
+ if @dwell.nil? || Time.now.to_f > @check_after
51
+ Sass::Plugin.check_for_updates
52
+ @check_after = Time.now.to_f + @dwell if @dwell
53
+ end
41
54
  @app.call(env)
42
55
  end
43
56
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sass
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0.alpha.37
4
+ version: 3.1.0.alpha.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Weizenbaum