m_is_for_monad 0.1.0 → 0.1.2
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 +4 -4
- data/README.md +2 -8
- data/lib/m/version.rb +1 -1
- data/lib/m.rb +18 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c3245c92b452b1265715eaea53ac89ea0f6d551641fe8972fb39e934cbbb7ba
|
4
|
+
data.tar.gz: eb26b51db9078a741e815feb5f1cd9e1e8125985dfe2e91f090bee90fbde176a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fd2396f6d03d81214cf1389924b6b6d16cf26685476f6f7a1ee204351164fdd1fecd66bddd3a40c73b6ee679d58de348ac84c0803c0e640ff5be27cf6d1a186
|
7
|
+
data.tar.gz: 37c18985ee6b0a254aa36eaab7bc5218ef9e533c5e3112f5ae2748602bceb9bae45126eddb904b2f509196378e1b575254fa18a013f7251d96aa35453cdd1262
|
data/README.md
CHANGED
@@ -4,24 +4,18 @@ Just a shorthand singleton module with static constructor methods to build monad
|
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
8
|
-
|
9
7
|
Install the gem and add to the application's Gemfile by executing:
|
10
8
|
|
11
9
|
```bash
|
12
|
-
bundle add
|
10
|
+
bundle add m_is_for_monad
|
13
11
|
```
|
14
12
|
|
15
13
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
16
14
|
|
17
15
|
```bash
|
18
|
-
gem install
|
16
|
+
gem install m_is_for_monad
|
19
17
|
```
|
20
18
|
|
21
|
-
## Usage
|
22
|
-
|
23
|
-
TODO: Write usage instructions here
|
24
|
-
|
25
19
|
## Development
|
26
20
|
|
27
21
|
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.
|
data/lib/m/version.rb
CHANGED
data/lib/m.rb
CHANGED
@@ -8,6 +8,18 @@ require 'dry/monads/all'
|
|
8
8
|
# So it expands monad methods in module functions and also includes all the monad constructors in the single place.
|
9
9
|
module M
|
10
10
|
include Dry::Monads
|
11
|
+
include List::Mixin
|
12
|
+
|
13
|
+
class << List
|
14
|
+
# @return [Proc]
|
15
|
+
def to_proc
|
16
|
+
@to_proc ||= method(:coerce).to_proc
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# Prepared {Dry::Monads::Do} mixin for `call` instance method.
|
21
|
+
DoForCall ||=
|
22
|
+
Do.for(:call)
|
11
23
|
|
12
24
|
# Creates a module that has two methods: `Success` and `Failure`.
|
13
25
|
# `Success` is identical to {Result::Mixin::Constructors#Success} and Failure
|
@@ -46,6 +58,12 @@ module M
|
|
46
58
|
Dry::Monads::Result::Fixed[error, **options]
|
47
59
|
end
|
48
60
|
|
61
|
+
# @see Dry::Monads::Do.call
|
62
|
+
define_method :Do, Do.method(:call)
|
63
|
+
|
64
|
+
# @see Dry::Monads::Do.bind
|
65
|
+
define_method :bind, Do.method(:bind)
|
66
|
+
|
49
67
|
# @!scope class
|
50
68
|
|
51
69
|
# @!method self.Try(*exceptions, &f)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: m_is_for_monad
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Semenov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-monads
|
@@ -63,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
63
|
- !ruby/object:Gem::Version
|
64
64
|
version: '0'
|
65
65
|
requirements: []
|
66
|
-
rubygems_version: 3.
|
66
|
+
rubygems_version: 3.4.5
|
67
67
|
signing_key:
|
68
68
|
specification_version: 4
|
69
69
|
summary: M is for Monad
|