ruff 2.0.1 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Top Level Namespace
8
8
 
9
- &mdash; Ruff 2.0.0 Documentation
9
+ &mdash; Ruff 2.1.0 Documentation
10
10
 
11
11
  </title>
12
12
 
@@ -100,9 +100,9 @@
100
100
  </div>
101
101
 
102
102
  <div id="footer">
103
- Generated on Thu Jan 2 20:01:55 2020 by
103
+ Generated on Wed Jun 10 21:24:09 2020 by
104
104
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
105
- 0.9.22 (ruby-2.6.5).
105
+ 0.9.25 (ruby-2.7.1).
106
106
  </div>
107
107
 
108
108
  </div>
@@ -24,4 +24,4 @@ require 'ruff/standard/measure_time'
24
24
  require 'ruff/standard/defer'
25
25
  require 'ruff/standard/state'
26
26
  require 'ruff/standard/async'
27
- require 'ruff/standard/call1cc'
27
+ require 'ruff/standard/delim_ctrl'
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ # `DelimCtrl` provides one-shot delimited control operators, `shift` and `reset`.
4
+ # @example
5
+ # DelimCtrl.reset {
6
+ # puts "hello"
7
+ # DelimCtrl.shift { |k|
8
+ # k.call
9
+ # puts "!"
10
+ # }
11
+ #
12
+ # puts "world"
13
+ # }
14
+ # # ==>
15
+ # # hello
16
+ # # world
17
+ # # !
18
+ module Ruff::Standard::DelimCtrl
19
+ # prompt stack
20
+ @stack = []
21
+
22
+ # delimits a continuation
23
+ # @param [Proc<(), A>] th
24
+ # is a thunk. In this thunk `shift` captures a continuation delimited with the thunk.
25
+ def reset(&th)
26
+ eff = Ruff::Effect.new
27
+ @stack.push eff
28
+
29
+ ret = Ruff.handler
30
+ .on(eff) do |k, f|
31
+ f.call(k)
32
+ end
33
+ .run(&th)
34
+
35
+ @stack.pop
36
+ ret
37
+ end
38
+
39
+ # captures a continuation.
40
+ # @param [Proc<Proc<C, A>, A/B>] k
41
+ # is a continuation.
42
+ def shift(&k)
43
+ # fetch nearmost prompt
44
+ top = @stack.last
45
+ top.perform(k)
46
+ end
47
+
48
+ module_function :reset, :shift
49
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ruff
4
- VERSION = '2.0.1'
4
+ VERSION = '2.1.0'
5
5
  end
data/version CHANGED
@@ -1 +1 @@
1
- 2.0.1
1
+ 2.1.0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruff
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - nymphium
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-01 00:00:00.000000000 Z
11
+ date: 2020-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -49,7 +49,6 @@ files:
49
49
  - ".rubocop.yml"
50
50
  - ".solargraph.yml"
51
51
  - Gemfile
52
- - Gemfile.lock
53
52
  - LICENSE
54
53
  - README.md
55
54
  - Rakefile
@@ -65,6 +64,7 @@ files:
65
64
  - docs/Ruff/Standard/CurrentTime/Instance.html
66
65
  - docs/Ruff/Standard/Defer.html
67
66
  - docs/Ruff/Standard/Defer/Instance.html
67
+ - docs/Ruff/Standard/DelimCtrl.html
68
68
  - docs/Ruff/Standard/MeasureTime.html
69
69
  - docs/Ruff/Standard/MeasureTime/Instance.html
70
70
  - docs/Ruff/Standard/State.html
@@ -96,9 +96,9 @@ files:
96
96
  - lib/ruff/objects.rb
97
97
  - lib/ruff/standard.rb
98
98
  - lib/ruff/standard/async.rb
99
- - lib/ruff/standard/call1cc.rb
100
99
  - lib/ruff/standard/current_time.rb
101
100
  - lib/ruff/standard/defer.rb
101
+ - lib/ruff/standard/delim_ctrl.rb
102
102
  - lib/ruff/standard/measure_time.rb
103
103
  - lib/ruff/standard/state.rb
104
104
  - lib/ruff/standard/util.rb
@@ -111,7 +111,7 @@ licenses:
111
111
  - MIT
112
112
  metadata:
113
113
  documentation_uri: https://nymphium.github.io/ruff
114
- post_install_message:
114
+ post_install_message:
115
115
  rdoc_options: []
116
116
  require_paths:
117
117
  - lib
@@ -126,8 +126,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
126
  - !ruby/object:Gem::Version
127
127
  version: '0'
128
128
  requirements: []
129
- rubygems_version: 3.1.2
130
- signing_key:
129
+ rubygems_version: 3.1.3
130
+ signing_key:
131
131
  specification_version: 4
132
132
  summary: ONE-SHOT Algebraic Effects for Ruby!
133
133
  test_files: []
@@ -1,68 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- ruff (2.0.1)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- ast (2.4.0)
10
- backport (1.1.2)
11
- io-console (0.5.4)
12
- irb (1.2.1)
13
- reline (>= 0.0.1)
14
- jaro_winkler (1.5.4)
15
- maruku (0.7.3)
16
- mini_portile2 (2.4.0)
17
- nokogiri (1.10.8)
18
- mini_portile2 (~> 2.4.0)
19
- parallel (1.19.1)
20
- parser (2.7.0.1)
21
- ast (~> 2.4.0)
22
- rainbow (3.0.0)
23
- rake (13.0.1)
24
- redcarpet (3.5.0)
25
- reline (0.1.2)
26
- io-console (~> 0.5)
27
- reverse_markdown (1.3.0)
28
- nokogiri
29
- rubocop (0.78.0)
30
- jaro_winkler (~> 1.5.1)
31
- parallel (~> 1.10)
32
- parser (>= 2.6)
33
- rainbow (>= 2.2.2, < 4.0)
34
- ruby-progressbar (~> 1.7)
35
- unicode-display_width (>= 1.4.0, < 1.7)
36
- ruby-progressbar (1.10.1)
37
- solargraph (0.38.0)
38
- backport (~> 1.1)
39
- bundler (>= 1.17.2)
40
- jaro_winkler (~> 1.5)
41
- maruku (~> 0.7, >= 0.7.3)
42
- nokogiri (~> 1.9, >= 1.9.1)
43
- parser (~> 2.3)
44
- reverse_markdown (~> 1.0, >= 1.0.5)
45
- rubocop (~> 0.52)
46
- thor (~> 0.19, >= 0.19.4)
47
- tilt (~> 2.0)
48
- yard (~> 0.9)
49
- thor (0.20.3)
50
- tilt (2.0.10)
51
- unicode-display_width (1.6.0)
52
- yard (0.9.22)
53
-
54
- PLATFORMS
55
- ruby
56
-
57
- DEPENDENCIES
58
- bundler (~> 2.0)
59
- irb (~> 1.0)
60
- rake (~> 13.0)
61
- redcarpet
62
- rubocop
63
- ruff!
64
- solargraph
65
- yard
66
-
67
- BUNDLED WITH
68
- 2.1.4
@@ -1,57 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # `Call1cc` provides call-with-oneshot-continuation.
4
- # The continuation can be run in the `context`.
5
- #
6
- # @example
7
- # Call1cc.context do
8
- # divfail = lambda { |l, default|
9
- # Call1cc.run {|k|
10
- # l.map{|e|
11
- # if e.zero?
12
- # k.call(default)
13
- # else
14
- # e / 2
15
- # end
16
- # }
17
- # }
18
- # }
19
- #
20
- # pp divfail.call([1, 3, 5], [1])
21
- # # ==> [0, 1, 2]
22
- # puts '---'
23
- # pp divfail.call([1, 0, 5], [1])
24
- # # ==> [1]
25
- # end
26
-
27
- module Ruff::Standard::Call1cc
28
- # call stack
29
- @stack = []
30
-
31
- def context(&prc)
32
- p = Ruff.instance
33
- @stack.push p
34
-
35
- ret = Ruff.handler
36
- .on(p) do |k, v|
37
- k.call(v)
38
- end
39
- .run(&prc)
40
-
41
- @stack.pop
42
- ret
43
- end
44
-
45
- def run(&f)
46
- top = @stack.first
47
- Ruff.handler
48
- .on(top) do |_, v|
49
- # abort the rest of computation from calling the continuation
50
- top.perform(v)
51
- end.run do
52
- f.call(->(v) { top.perform(v) })
53
- end
54
- end
55
-
56
- module_function :context, :run
57
- end