m_is_for_monad 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -8
  3. data/lib/m/version.rb +1 -1
  4. data/lib/m.rb +18 -0
  5. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ce99a53cc8457d98f753159da692dea65b583c3ee04daebdb8523a0f8362c58
4
- data.tar.gz: b5483861024d2a16744c0ccdd14b6dc6c75677b7b7dc8be1d9a960ef47abe0ef
3
+ metadata.gz: 6c3245c92b452b1265715eaea53ac89ea0f6d551641fe8972fb39e934cbbb7ba
4
+ data.tar.gz: eb26b51db9078a741e815feb5f1cd9e1e8125985dfe2e91f090bee90fbde176a
5
5
  SHA512:
6
- metadata.gz: e9275c6c3ef00a061e3fb025acd58b0ea2aed7c18157f17d6e6d41c6a88664b040a6aa9f7706f0737dd495fe5773b1c297886d0d7271c6e12e07f02a37777934
7
- data.tar.gz: df69dcfcdb8f3df20e0cedd1f5052306da61ad07f482598cb431e361235a5a846d3fe22503ba30434496055b4594c29da3f22ff5293180755ee6c6b53e29a297
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 UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
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 UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module M
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.2"
5
5
  end
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.0
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: 2024-12-02 00:00:00.000000000 Z
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.0.3
66
+ rubygems_version: 3.4.5
67
67
  signing_key:
68
68
  specification_version: 4
69
69
  summary: M is for Monad