lalka 0.7.0 → 1.0.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f052e0cce98cefd5a400f81e00280c0670c244dc
4
- data.tar.gz: e29c8e0b3d7ae4720d91ea5fd061719ce0c43997
3
+ metadata.gz: 542e2e1eb9c6cb8c0c06caf00441fe62725d1481
4
+ data.tar.gz: 54388187231a1df55b04fdf3a23210e87d5562f8
5
5
  SHA512:
6
- metadata.gz: e2c4d41777640d33f50a82fdac121d0ca1460e243946ea687ffb66b53d0750b723b16bf475afa4cb647e3e8942dd21ca8c90dc38d124f6855d5aa155c64cf54a
7
- data.tar.gz: 52c6004164ae271f1c7e5f6bfaa22e80d9538ad6c9988b3c943a4dc4a004296462d5077b91caef47b6cb0dc828d338c2fad680284ebce220329a00ff10ab2973
6
+ metadata.gz: 815108b4f5a393ae43483c34e45b9f205e431a22d44b7b6cc9ed5e44712a1140ce55c0c5fdbe558aa8af9ef881e4eb8afc1a158f1fc015e605890aae5ea8533d
7
+ data.tar.gz: 6b85ca6700e1af2d992b32883d25085acda77c3f8869af30823d09222a97523d1f962c27bdcc50a902acde41e5fd778cece3f6c6ab547921f8443e1c5459efd2
data/README.md CHANGED
@@ -1,11 +1,9 @@
1
1
  # Lalka
2
2
  [![Build Status](https://travis-ci.org/v-shmyhlo/lalka.svg?branch=master)](https://travis-ci.org/v-shmyhlo/lalka)
3
3
 
4
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/lalka`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+ Lalka is a ruby implementation of a Task monad (aka Continuation monad) - usefull abstraction for managing parallel and concurrent code.
5
5
 
6
- TODO: Delete this and the text above, and describe your gem
7
-
8
- # Usage
6
+ ## Usage
9
7
 
10
8
  ### Create:
11
9
  ```ruby
@@ -45,17 +43,9 @@ TODO: Delete this and the text above, and describe your gem
45
43
  ### fork_wait:
46
44
  ```ruby
47
45
  # executes computation, fork_wait blocks and returns Either from "dry-monads" gem
48
- task = Lalka::Task.resolve(99)
49
-
50
- result = task.fork_wait do |t|
51
- t.on_success do |value|
52
- value + 1
53
- end
46
+ task = Lalka::Task.resolve(100)
54
47
 
55
- t.on_error do |error|
56
- # ...
57
- end
58
- end
48
+ result = task.fork_wait
59
49
 
60
50
  result # Right(100)
61
51
  ```
@@ -63,17 +53,9 @@ TODO: Delete this and the text above, and describe your gem
63
53
  ```ruby
64
54
  task = Lalka::Task.reject('error')
65
55
 
66
- result = task.fork_wait do |t|
67
- t.on_success do |value|
68
- # ...
69
- end
70
-
71
- t.on_error do |error|
72
- "Error: " + error
73
- end
74
- end
56
+ result = task.fork_wait
75
57
 
76
- result # Left("Error: error")
58
+ result # Left("error")
77
59
  ```
78
60
 
79
61
  ### map:
@@ -137,22 +119,16 @@ Or install it yourself as:
137
119
 
138
120
  $ gem install lalka
139
121
 
140
- ## Usage
141
-
142
- TODO: Write usage instructions here
143
-
144
122
  ## Development
145
123
 
146
124
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
147
125
 
148
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
126
+ To install this gem onto your local machine, run `bundle exec rake install`.
149
127
 
150
128
  ## Contributing
151
129
 
152
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/lalka. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
153
-
130
+ Bug reports and pull requests are welcome on GitHub at https://github.com/v-shmyhlo/lalka. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
154
131
 
155
132
  ## License
156
133
 
157
134
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
158
-
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  require 'dry-monads'
3
-
4
3
  require 'lalka/version'
5
4
 
6
5
  module Lalka
@@ -38,12 +37,8 @@ module Lalka
38
37
  queue = Queue.new
39
38
  internal = Internal.new(queue)
40
39
 
41
- if block_given?
42
- yield internal
43
- else
44
- internal.on_success { |v| v }
45
- internal.on_error { |e| e }
46
- end
40
+ internal.on_success { |v| v }
41
+ internal.on_error { |e| e }
47
42
 
48
43
  internal.call(&@computation)
49
44
  queue.pop
@@ -163,7 +158,7 @@ module Lalka
163
158
 
164
159
  def function_from_arguments(*args, &block)
165
160
  if block_given?
166
- raise ArgumentError, 'both block and function provided' if args.length != 0
161
+ raise ArgumentError, 'both block and function provided' unless args.empty?
167
162
  block
168
163
  else
169
164
  raise ArgumentError, 'no block or function provided' if args.length != 1
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Lalka
3
- VERSION = '0.7.0'
3
+ VERSION = '1.0.0'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lalka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vlad Shmyhlo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-23 00:00:00.000000000 Z
11
+ date: 2017-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-monads
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  version: '0'
135
135
  requirements: []
136
136
  rubyforge_project:
137
- rubygems_version: 2.6.6
137
+ rubygems_version: 2.6.11
138
138
  signing_key:
139
139
  specification_version: 4
140
140
  summary: Task monad