ruff 1.0.0 → 1.0.1

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.
@@ -242,12 +242,12 @@
242
242
  <pre class="lines">
243
243
 
244
244
 
245
- 42
246
- 43
247
- 44</pre>
245
+ 44
246
+ 45
247
+ 46</pre>
248
248
  </td>
249
249
  <td>
250
- <pre class="code"><span class="info file"># File 'lib/ruff/standard/state.rb', line 42</span>
250
+ <pre class="code"><span class="info file"># File 'lib/ruff/standard/state.rb', line 44</span>
251
251
 
252
252
  <span class='kw'>def</span> <span class='id identifier rubyid_get'>get</span>
253
253
  <span class='ivar'>@inst</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span>
@@ -272,14 +272,14 @@
272
272
  <pre class="lines">
273
273
 
274
274
 
275
- 46
276
- 47
277
- 48</pre>
275
+ 48
276
+ 49
277
+ 50</pre>
278
278
  </td>
279
279
  <td>
280
- <pre class="code"><span class="info file"># File 'lib/ruff/standard/state.rb', line 46</span>
280
+ <pre class="code"><span class="info file"># File 'lib/ruff/standard/state.rb', line 48</span>
281
281
 
282
- <span class='kw'>def</span> <span class='id identifier rubyid_modify'>modify</span> <span class='op'>&amp;</span><span class='id identifier rubyid_fn'>fn</span>
282
+ <span class='kw'>def</span> <span class='id identifier rubyid_modify'>modify</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_fn'>fn</span><span class='rparen'>)</span>
283
283
  <span class='ivar'>@inst</span><span class='period'>.</span><span class='id identifier rubyid_modify'>modify</span> <span class='op'>&amp;</span><span class='id identifier rubyid_fn'>fn</span>
284
284
  <span class='kw'>end</span></pre>
285
285
  </td>
@@ -302,14 +302,14 @@
302
302
  <pre class="lines">
303
303
 
304
304
 
305
- 50
306
- 51
307
- 52</pre>
305
+ 52
306
+ 53
307
+ 54</pre>
308
308
  </td>
309
309
  <td>
310
- <pre class="code"><span class="info file"># File 'lib/ruff/standard/state.rb', line 50</span>
310
+ <pre class="code"><span class="info file"># File 'lib/ruff/standard/state.rb', line 52</span>
311
311
 
312
- <span class='kw'>def</span> <span class='id identifier rubyid_put'>put</span> <span class='id identifier rubyid_s'>s</span>
312
+ <span class='kw'>def</span> <span class='id identifier rubyid_put'>put</span><span class='lparen'>(</span><span class='id identifier rubyid_s'>s</span><span class='rparen'>)</span>
313
313
  <span class='ivar'>@inst</span><span class='period'>.</span><span class='id identifier rubyid_put'>put</span> <span class='id identifier rubyid_s'>s</span>
314
314
  <span class='kw'>end</span></pre>
315
315
  </td>
@@ -332,14 +332,14 @@
332
332
  <pre class="lines">
333
333
 
334
334
 
335
- 58
336
- 59
337
- 60</pre>
335
+ 60
336
+ 61
337
+ 62</pre>
338
338
  </td>
339
339
  <td>
340
- <pre class="code"><span class="info file"># File 'lib/ruff/standard/state.rb', line 58</span>
340
+ <pre class="code"><span class="info file"># File 'lib/ruff/standard/state.rb', line 60</span>
341
341
 
342
- <span class='kw'>def</span> <span class='id identifier rubyid_with'>with</span> <span class='op'>&amp;</span><span class='id identifier rubyid_task'>task</span>
342
+ <span class='kw'>def</span> <span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_task'>task</span><span class='rparen'>)</span>
343
343
  <span class='ivar'>@inst</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span> <span class='op'>&amp;</span><span class='id identifier rubyid_task'>task</span>
344
344
  <span class='kw'>end</span></pre>
345
345
  </td>
@@ -362,14 +362,14 @@
362
362
  <pre class="lines">
363
363
 
364
364
 
365
- 54
366
- 55
367
- 56</pre>
365
+ 56
366
+ 57
367
+ 58</pre>
368
368
  </td>
369
369
  <td>
370
- <pre class="code"><span class="info file"># File 'lib/ruff/standard/state.rb', line 54</span>
370
+ <pre class="code"><span class="info file"># File 'lib/ruff/standard/state.rb', line 56</span>
371
371
 
372
- <span class='kw'>def</span> <span class='id identifier rubyid_with_init'>with_init</span> <span class='id identifier rubyid_init'>init</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_task'>task</span>
372
+ <span class='kw'>def</span> <span class='id identifier rubyid_with_init'>with_init</span><span class='lparen'>(</span><span class='id identifier rubyid_init'>init</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_task'>task</span><span class='rparen'>)</span>
373
373
  <span class='ivar'>@inst</span><span class='period'>.</span><span class='id identifier rubyid_with_init'>with_init</span> <span class='id identifier rubyid_init'>init</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_task'>task</span>
374
374
  <span class='kw'>end</span></pre>
375
375
  </td>
@@ -382,7 +382,7 @@
382
382
  </div>
383
383
 
384
384
  <div id="footer">
385
- Generated on Thu Oct 3 03:27:26 2019 by
385
+ Generated on Thu Oct 3 05:05:04 2019 by
386
386
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
387
387
  0.9.20 (ruby-2.6.4).
388
388
  </div>
@@ -105,7 +105,7 @@
105
105
  </div>
106
106
 
107
107
  <div id="footer">
108
- Generated on Thu Oct 3 03:27:26 2019 by
108
+ Generated on Thu Oct 3 05:05:04 2019 by
109
109
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
110
110
  0.9.20 (ruby-2.6.4).
111
111
  </div>
@@ -243,12 +243,12 @@
243
243
  <pre class="lines">
244
244
 
245
245
 
246
- 14
247
- 15
248
- 16</pre>
246
+ 16
247
+ 17
248
+ 18</pre>
249
249
  </td>
250
250
  <td>
251
- <pre class="code"><span class="info file"># File 'lib/ruff/objects.rb', line 14</span>
251
+ <pre class="code"><span class="info file"># File 'lib/ruff/objects.rb', line 16</span>
252
252
 
253
253
  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
254
254
  <span class='ivar'>@id</span> <span class='op'>=</span> <span class='id identifier rubyid_id'>id</span><span class='semicolon'>;</span> <span class='ivar'>@args</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span>
@@ -290,12 +290,12 @@
290
290
  <pre class="lines">
291
291
 
292
292
 
293
- 11
294
- 12
295
- 13</pre>
293
+ 13
294
+ 14
295
+ 15</pre>
296
296
  </td>
297
297
  <td>
298
- <pre class="code"><span class="info file"># File 'lib/ruff/objects.rb', line 11</span>
298
+ <pre class="code"><span class="info file"># File 'lib/ruff/objects.rb', line 13</span>
299
299
 
300
300
  <span class='kw'>def</span> <span class='id identifier rubyid_args'>args</span>
301
301
  <span class='ivar'>@args</span>
@@ -332,12 +332,12 @@
332
332
  <pre class="lines">
333
333
 
334
334
 
335
- 8
336
- 9
337
- 10</pre>
335
+ 10
336
+ 11
337
+ 12</pre>
338
338
  </td>
339
339
  <td>
340
- <pre class="code"><span class="info file"># File 'lib/ruff/objects.rb', line 8</span>
340
+ <pre class="code"><span class="info file"># File 'lib/ruff/objects.rb', line 10</span>
341
341
 
342
342
  <span class='kw'>def</span> <span class='id identifier rubyid_id'>id</span>
343
343
  <span class='ivar'>@id</span>
@@ -353,7 +353,7 @@
353
353
  </div>
354
354
 
355
355
  <div id="footer">
356
- Generated on Thu Oct 3 03:27:27 2019 by
356
+ Generated on Thu Oct 3 05:05:04 2019 by
357
357
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
358
358
  0.9.20 (ruby-2.6.4).
359
359
  </div>
@@ -243,12 +243,12 @@
243
243
  <pre class="lines">
244
244
 
245
245
 
246
- 30
247
- 31
248
- 32</pre>
246
+ 32
247
+ 33
248
+ 34</pre>
249
249
  </td>
250
250
  <td>
251
- <pre class="code"><span class="info file"># File 'lib/ruff/objects.rb', line 30</span>
251
+ <pre class="code"><span class="info file"># File 'lib/ruff/objects.rb', line 32</span>
252
252
 
253
253
  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_eff'>eff</span><span class='comma'>,</span> <span class='id identifier rubyid_k'>k</span><span class='rparen'>)</span>
254
254
  <span class='ivar'>@eff</span> <span class='op'>=</span> <span class='id identifier rubyid_eff'>eff</span><span class='semicolon'>;</span> <span class='ivar'>@k</span> <span class='op'>=</span> <span class='id identifier rubyid_k'>k</span>
@@ -290,12 +290,12 @@
290
290
  <pre class="lines">
291
291
 
292
292
 
293
- 24
294
- 25
295
- 26</pre>
293
+ 26
294
+ 27
295
+ 28</pre>
296
296
  </td>
297
297
  <td>
298
- <pre class="code"><span class="info file"># File 'lib/ruff/objects.rb', line 24</span>
298
+ <pre class="code"><span class="info file"># File 'lib/ruff/objects.rb', line 26</span>
299
299
 
300
300
  <span class='kw'>def</span> <span class='id identifier rubyid_eff'>eff</span>
301
301
  <span class='ivar'>@eff</span>
@@ -332,12 +332,12 @@
332
332
  <pre class="lines">
333
333
 
334
334
 
335
- 27
336
- 28
337
- 29</pre>
335
+ 29
336
+ 30
337
+ 31</pre>
338
338
  </td>
339
339
  <td>
340
- <pre class="code"><span class="info file"># File 'lib/ruff/objects.rb', line 27</span>
340
+ <pre class="code"><span class="info file"># File 'lib/ruff/objects.rb', line 29</span>
341
341
 
342
342
  <span class='kw'>def</span> <span class='id identifier rubyid_k'>k</span>
343
343
  <span class='ivar'>@k</span>
@@ -353,7 +353,7 @@
353
353
  </div>
354
354
 
355
355
  <div id="footer">
356
- Generated on Thu Oct 3 03:27:27 2019 by
356
+ Generated on Thu Oct 3 05:05:04 2019 by
357
357
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
358
358
  0.9.20 (ruby-2.6.4).
359
359
  </div>
@@ -110,7 +110,7 @@
110
110
  </div>
111
111
 
112
112
  <div id="footer">
113
- Generated on Thu Oct 3 03:27:26 2019 by
113
+ Generated on Thu Oct 3 05:05:04 2019 by
114
114
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
115
115
  0.9.20 (ruby-2.6.4).
116
116
  </div>
data/docs/Ruff.html CHANGED
@@ -78,25 +78,14 @@
78
78
 
79
79
  <dl>
80
80
  <dt>Defined in:</dt>
81
- <dd>lib/ruff/version.cpp.rb<span class="defines">,<br />
82
- lib/ruff.rb,<br /> lib/ruff/version.rb</span>
81
+ <dd>lib/ruff.rb<span class="defines">,<br />
82
+ lib/ruff/version.rb</span>
83
83
  </dd>
84
84
  </dl>
85
85
 
86
86
  </div>
87
87
 
88
- <h2>Overview</h2><div class="docstring">
89
- <div class="discussion">
90
- <p>// This file is passed to CPP
91
- include &quot;../../version.h&quot;</p>
92
-
93
-
94
- </div>
95
- </div>
96
- <div class="tags">
97
-
98
-
99
- </div><h2>Defined Under Namespace</h2>
88
+ <h2>Defined Under Namespace</h2>
100
89
  <p class="children">
101
90
 
102
91
 
@@ -120,7 +109,7 @@ include &quot;../../version.h&quot;</p>
120
109
  <dt id="VERSION-constant" class="">VERSION =
121
110
 
122
111
  </dt>
123
- <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>1.0.0</span><span class='tstring_end'>&quot;</span></span></pre></dd>
112
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>1.0.0</span><span class='tstring_end'>&#39;</span></span></pre></dd>
124
113
 
125
114
  </dl>
126
115
 
@@ -237,12 +226,12 @@ include &quot;../../version.h&quot;</p>
237
226
  <pre class="lines">
238
227
 
239
228
 
240
- 26
241
- 27
242
- 28</pre>
229
+ 28
230
+ 29
231
+ 30</pre>
243
232
  </td>
244
233
  <td>
245
- <pre class="code"><span class="info file"># File 'lib/ruff.rb', line 26</span>
234
+ <pre class="code"><span class="info file"># File 'lib/ruff.rb', line 28</span>
246
235
 
247
236
  <span class='kw'>def</span> <span class='id identifier rubyid_handler'>handler</span>
248
237
  <span class='const'><span class='object_link'><a href="Ruff/Handler.html" title="Ruff::Handler (class)">Handler</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Ruff/Handler.html#initialize-instance_method" title="Ruff::Handler#initialize (method)">new</a></span></span>
@@ -292,12 +281,12 @@ include &quot;../../version.h&quot;</p>
292
281
  <pre class="lines">
293
282
 
294
283
 
295
- 14
296
- 15
297
- 16</pre>
284
+ 16
285
+ 17
286
+ 18</pre>
298
287
  </td>
299
288
  <td>
300
- <pre class="code"><span class="info file"># File 'lib/ruff.rb', line 14</span>
289
+ <pre class="code"><span class="info file"># File 'lib/ruff.rb', line 16</span>
301
290
 
302
291
  <span class='kw'>def</span> <span class='id identifier rubyid_instance'>instance</span>
303
292
  <span class='const'><span class='object_link'><a href="Ruff/Effect.html" title="Ruff::Effect (class)">Effect</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Ruff/Effect.html#initialize-instance_method" title="Ruff::Effect#initialize (method)">new</a></span></span>
@@ -312,7 +301,7 @@ include &quot;../../version.h&quot;</p>
312
301
  </div>
313
302
 
314
303
  <div id="footer">
315
- Generated on Thu Oct 3 03:27:26 2019 by
304
+ Generated on Thu Oct 3 05:05:04 2019 by
316
305
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
317
306
  0.9.20 (ruby-2.6.4).
318
307
  </div>
data/docs/_index.html CHANGED
@@ -240,7 +240,7 @@
240
240
  </div>
241
241
 
242
242
  <div id="footer">
243
- Generated on Thu Oct 3 03:27:26 2019 by
243
+ Generated on Thu Oct 3 05:05:03 2019 by
244
244
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
245
245
  0.9.20 (ruby-2.6.4).
246
246
  </div>
@@ -162,7 +162,7 @@
162
162
  </div></div>
163
163
 
164
164
  <div id="footer">
165
- Generated on Thu Oct 3 03:27:26 2019 by
165
+ Generated on Thu Oct 3 05:05:04 2019 by
166
166
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
167
167
  0.9.20 (ruby-2.6.4).
168
168
  </div>
data/docs/index.html CHANGED
@@ -162,7 +162,7 @@
162
162
  </div></div>
163
163
 
164
164
  <div id="footer">
165
- Generated on Thu Oct 3 03:27:26 2019 by
165
+ Generated on Thu Oct 3 05:05:04 2019 by
166
166
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
167
167
  0.9.20 (ruby-2.6.4).
168
168
  </div>
@@ -100,7 +100,7 @@
100
100
  </div>
101
101
 
102
102
  <div id="footer">
103
- Generated on Thu Oct 3 03:27:26 2019 by
103
+ Generated on Thu Oct 3 05:05:04 2019 by
104
104
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
105
105
  0.9.20 (ruby-2.6.4).
106
106
  </div>
data/lib/ruff/effect.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This class provides an effect instance.
2
4
  class Ruff::Effect
3
5
  # Each instance must be unique so they have unique id with UUID
@@ -18,6 +20,6 @@ class Ruff::Effect
18
20
  # @example
19
21
  # Log.perform "hello"
20
22
  def perform(*a)
21
- return Fiber.yield Ruff::Throws::Eff.new(@id, a)
23
+ Fiber.yield Ruff::Throws::Eff.new(@id, a)
22
24
  end
23
25
  end
data/lib/ruff/handler.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'securerandom'
2
4
 
3
5
  # In algebraic effects, handler is an first-class object.
@@ -13,12 +15,10 @@ class Ruff::Handler
13
15
  # handler = Handler.new
14
16
 
15
17
  def initialize
16
- @handlers = Hash.new
17
- @valh_id = SecureRandom.uuid
18
- @handlers[@valh_id] = ->(x) { x }
18
+ @handlers = {}
19
+ @valh = ->(x) { x }
19
20
  end
20
21
 
21
-
22
22
  # sets value handler `&fun`.
23
23
  #
24
24
  # Value handler is the handler for *the result value of the computation*.
@@ -54,7 +54,7 @@ class Ruff::Handler
54
54
  # # returns !
55
55
 
56
56
  def to(&fun)
57
- @handlers[@valh_id] = fun
57
+ @valh = fun
58
58
 
59
59
  self
60
60
  end
@@ -109,54 +109,51 @@ class Ruff::Handler
109
109
  continue = nil
110
110
  rehandles = nil
111
111
 
112
- handle = ->(r) {
113
- if r.is_a? Eff
112
+ handle = lambda { |r|
113
+ case r
114
+ when Eff
114
115
  if effh = @handlers[r.id]
115
116
  effh[continue, *r.args]
116
117
  else
117
118
  Fiber.yield Resend.new(r, continue)
118
119
  end
119
- elsif r.is_a? Resend
120
+ when Resend then
120
121
  eff = r.eff
121
- next_k = rehandles.(r.k)
122
+ next_k = rehandles.call(r.k)
122
123
 
123
124
  if effh = @handlers[eff.id]
124
- effh.(next_k, *eff.args)
125
+ effh.call(next_k, *eff.args)
125
126
  else
126
127
  Fiber.yield Resend.new(eff, next_k)
127
128
  end
128
129
  else
129
- @handlers[@valh_id].(r)
130
+ @valh.call(r)
130
131
  end
131
132
  }
132
133
 
133
- rehandles = ->(k){
134
+ rehandles = lambda { |k|
134
135
  newh = self.class.new
135
- def newh.add_handler id, h
136
+ def newh.add_handler(id, h)
136
137
  @handlers[id] = h
137
138
  end
138
139
 
139
- @handlers.each{|id, h|
140
+ @handlers.each do |id, h|
140
141
  newh.add_handler id, h
141
- }
142
+ end
142
143
 
143
144
  class << newh
144
145
  undef add_handler
145
146
  end
146
147
 
147
- ->(*args) {
148
- continue[
149
- newh.run {
150
- k.(*args)
151
- }
152
- ]
148
+ lambda { |*args|
149
+ continue.call(newh.run { k.call(*args) })
153
150
  }
154
151
  }
155
152
 
156
- continue = ->(*arg) {
157
- handle.(co.resume(*arg))
153
+ continue = lambda { |*arg|
154
+ handle.call(co.resume(*arg))
158
155
  }
159
156
 
160
- continue.(nil)
157
+ continue.call(nil)
161
158
  end
162
159
  end
data/lib/ruff/objects.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Ruff::Throws end
2
4
 
3
5
  # `Eff` is internal object.
@@ -20,7 +22,7 @@ end
20
22
  #
21
23
  # It is used when an effect is unable to be handled and should be thrown to the outer handler.
22
24
  class Ruff::Throws::Resend
23
- #is abstracted effect (such as `Eff` or (re)thrown `Resend`).
25
+ # is abstracted effect (such as `Eff` or (re)thrown `Resend`).
24
26
  attr_reader :eff
25
27
 
26
28
  # is a continuation of `eff` thrown context.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Ruff::Standard::CurrentTime
2
4
  class Instance
3
5
  def initialize
@@ -8,8 +10,8 @@ module Ruff::Standard::CurrentTime
8
10
  @eff.perform
9
11
  end
10
12
 
11
- def with &th
12
- Ruff.handler.on(@eff){|k| k[Time.now]}.run &th
13
+ def with(&th)
14
+ Ruff.handler.on(@eff) { |k| k[Time.now] }.run &th
13
15
  end
14
16
  end
15
17
 
@@ -20,10 +22,9 @@ module Ruff::Standard::CurrentTime
20
22
  @inst.get
21
23
  end
22
24
 
23
- def with &th
25
+ def with(&th)
24
26
  @inst.with &th
25
27
  end
26
28
 
27
29
  module_function :get, :with
28
30
  end
29
-
@@ -1,38 +1,38 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Ruff::Standard::Defer
2
4
  class Instance
3
5
  def initialize
4
6
  @eff = Ruff.instance
5
7
  end
6
8
 
7
- def register &prc
9
+ def register(&prc)
8
10
  @eff.perform prc
9
11
  end
10
12
 
11
- def with &th
13
+ def with(&th)
12
14
  procs = []
13
15
 
14
16
  Ruff.handler
15
- .on(@eff){|k, prc|
16
- procs << prc
17
- k[]
18
- }
19
- .to {|_|
20
- procs.reverse_each{|prc|
21
- prc[]
22
- }
23
- }
24
- .run &th
17
+ .on(@eff) do |k, prc|
18
+ procs << prc
19
+ k[]
20
+ end
21
+ .to do |_|
22
+ procs.reverse_each(&:[])
23
+ end
24
+ .run &th
25
25
  end
26
26
  end
27
27
 
28
28
  # ---
29
29
  @inst = Instance.new
30
30
 
31
- def register &prc
31
+ def register(&prc)
32
32
  @inst.register &prc
33
33
  end
34
34
 
35
- def with &th
35
+ def with(&th)
36
36
  @inst.with &th
37
37
  end
38
38
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Ruff::Standard::State
2
4
  class Instance
3
5
  def initialize
@@ -9,29 +11,29 @@ module Ruff::Standard::State
9
11
  @get.perform
10
12
  end
11
13
 
12
- def modify &fn
14
+ def modify(&fn)
13
15
  @modify.perform fn
14
16
  end
15
17
 
16
- def put s
18
+ def put(s)
17
19
  @modify.perform ->(_) { s }
18
20
  end
19
21
 
20
- def with_init init, &task
22
+ def with_init(init, &task)
21
23
  state = init
22
24
 
23
25
  Ruff.handler
24
- .on(@modify){|k, fn|
25
- state = fn[state]
26
- k[nil]
27
- }
28
- .on(@get){|k|
29
- k[state]
30
- }
31
- .run &task
26
+ .on(@modify) do |k, fn|
27
+ state = fn[state]
28
+ k[nil]
29
+ end
30
+ .on(@get) do |k|
31
+ k[state]
32
+ end
33
+ .run &task
32
34
  end
33
35
 
34
- def with &task
36
+ def with(&task)
35
37
  with_init(nil, &task)
36
38
  end
37
39
  end
@@ -43,22 +45,21 @@ module Ruff::Standard::State
43
45
  @inst.get
44
46
  end
45
47
 
46
- def modify &fn
48
+ def modify(&fn)
47
49
  @inst.modify &fn
48
50
  end
49
51
 
50
- def put s
52
+ def put(s)
51
53
  @inst.put s
52
54
  end
53
55
 
54
- def with_init init, &task
56
+ def with_init(init, &task)
55
57
  @inst.with_init init, &task
56
58
  end
57
59
 
58
- def with &task
60
+ def with(&task)
59
61
  @inst.with &task
60
62
  end
61
63
 
62
64
  module_function :get, :put, :modify, :with, :with_init
63
65
  end
64
-