u-thenable 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a837300856003ed511ba7ba6535be68982ba52a9
4
+ data.tar.gz: 8246715e9887bb79b7436694702373b60264c857
5
+ SHA512:
6
+ metadata.gz: 478157b5681eb04b1f9fd451855c6d7bc74eea5f1776fcc99fcb6f910f8519516e59d6f9b441434ecbff9c86f191c1492fdc9e61e3e3f0c3b6998c100f6068a6
7
+ data.tar.gz: 76329e009a2fd5222421d1da7ec1f915914fc0710ecad72c3de18e690743ef365a4a5837fdd4d2a1a7adf92b1937351839b1fad0f2366f7b00b68d1b4d8ecaee
data/thenable-ext.rb ADDED
@@ -0,0 +1,3 @@
1
+ require_relative 'thenable'
2
+
3
+ Object.include(Thenable::Mixin)
data/thenable.rb ADDED
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Thenable
4
+ VERSION = '1.0.0'
5
+
6
+ def self.included(base)
7
+ base.send(:include, Mixin) if RUBY_VERSION < '2.5.0'
8
+ base.extend(Mixin) if RUBY_VERSION < '2.5.0'
9
+ end
10
+
11
+ def self.extended(base)
12
+ base.extend(Mixin) if RUBY_VERSION < '2.5.0'
13
+ end
14
+
15
+ module Mixin
16
+ if RUBY_VERSION < '2.5.0'
17
+ def yield_self
18
+ return yield(self) if block_given?
19
+
20
+ Enumerator.new { |yielder| yielder.yield(self) }
21
+ end
22
+ end
23
+
24
+ alias_method(:then, :yield_self) if RUBY_VERSION < '2.6.0'
25
+ end
26
+ end
data/u-thenable-ext.rb ADDED
@@ -0,0 +1 @@
1
+ require_relative 'thenable-ext'
data/u-thenable.rb ADDED
@@ -0,0 +1 @@
1
+ require_relative 'thenable'
metadata ADDED
@@ -0,0 +1,50 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: u-thenable
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Rodrigo Serradura
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-01-18 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A backport/polyfill of `yield self` and` then` methods for old Ruby versions.
14
+ email: rodrigo.serradura@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - thenable-ext.rb
20
+ - thenable.rb
21
+ - u-thenable-ext.rb
22
+ - u-thenable.rb
23
+ homepage: https://gist.github.com/serradura/9df18569d6e8eb7d9b293d28f977dd7b
24
+ licenses:
25
+ - MIT
26
+ metadata: {}
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - "."
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: 2.2.2
36
+ - - "<"
37
+ - !ruby/object:Gem::Version
38
+ version: 2.6.0
39
+ required_rubygems_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ requirements: []
45
+ rubyforge_project:
46
+ rubygems_version: 2.5.1
47
+ signing_key:
48
+ specification_version: 4
49
+ summary: A backport/polyfill of `yield_self` and `then` methods.
50
+ test_files: []