chainer 0.0.0 → 0.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.
- checksums.yaml +4 -4
- data/lib/chainer/method.rb +34 -0
- data/lib/chainer/version.rb +6 -0
- data/lib/chainer.rb +6 -0
- metadata +63 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35ce532c07636158a8d4ed43adced633b1978eae
|
4
|
+
data.tar.gz: d00bd5d51d4673ad51da9bcf5c2c03bbb614cdf9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c428d4bc1b6d9c64b5f1b78e9497acf5c9f035ab28bd35f8625f928e739ec08b8409454ac09f22e217c14a4c191211f775ded1c5eff9aff31de6a8168fd52a6
|
7
|
+
data.tar.gz: f0486ea8fbe60cd7c6e6324e7e30b585ca71e47e23859943417cfcc0e4d3010ea3dd90347cc2805a828afd5d5e895f0357064138af984eb141163d150f626ad6
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Chainer
|
4
|
+
|
5
|
+
# Pipes method names on a context class
|
6
|
+
class Method
|
7
|
+
|
8
|
+
# @!attribute [r] context
|
9
|
+
# @return [Object] Context to call piped methods on
|
10
|
+
# @!attribute [r] value
|
11
|
+
# @return [Object] Value to pass to the next method in the pipe
|
12
|
+
attr_reader :context, :value
|
13
|
+
|
14
|
+
# Initializes pipe wrapper
|
15
|
+
#
|
16
|
+
# @param [Object] context Context to call piped methods on
|
17
|
+
# @param [Object] value Value to pass to the next method in the pipe
|
18
|
+
def initialize(context, value)
|
19
|
+
@context = context
|
20
|
+
@value = value.is_a?(self.class) ? value.value : value
|
21
|
+
freeze
|
22
|
+
end
|
23
|
+
|
24
|
+
# The "pipe" operator. Calls passed +object+ with the wrapped +value+
|
25
|
+
#
|
26
|
+
# @param [Symbol] method_name Method name to be called on the context +object+
|
27
|
+
#
|
28
|
+
# @return [self] Wrapped result of calculations
|
29
|
+
def >>(method_name) # rubocop:disable Style/OpMethod
|
30
|
+
self.class.new context, context.send(method_name, value)
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
data/lib/chainer.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chainer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Viktor Lazarev
|
@@ -9,13 +9,72 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2017-03-01 00:00:00.000000000 Z
|
12
|
-
dependencies:
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rubocop
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.47'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.47'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubocop-rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.12'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.12'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.5'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.5'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: yard
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.9.8
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.9.8
|
13
69
|
description: Allows to pipe Ruby calls in a nice way
|
14
70
|
email: taurus101v@gmail.com
|
15
71
|
executables: []
|
16
72
|
extensions: []
|
17
73
|
extra_rdoc_files: []
|
18
|
-
files:
|
74
|
+
files:
|
75
|
+
- lib/chainer.rb
|
76
|
+
- lib/chainer/method.rb
|
77
|
+
- lib/chainer/version.rb
|
19
78
|
homepage: https://github.com/gentoid/chainer
|
20
79
|
licenses:
|
21
80
|
- MIT
|
@@ -36,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
36
95
|
version: '0'
|
37
96
|
requirements: []
|
38
97
|
rubyforge_project:
|
39
|
-
rubygems_version: 2.
|
98
|
+
rubygems_version: 2.6.8
|
40
99
|
signing_key:
|
41
100
|
specification_version: 4
|
42
101
|
summary: Allows to pipe Ruby calls in a nice way
|