chainer 0.0.1 → 0.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 35ce532c07636158a8d4ed43adced633b1978eae
4
- data.tar.gz: d00bd5d51d4673ad51da9bcf5c2c03bbb614cdf9
3
+ metadata.gz: 80d61bde19a25ac4f2416b9883cad770498e4cb5
4
+ data.tar.gz: 9c1fbbc2922a2fad84f7eff93268e243d053e569
5
5
  SHA512:
6
- metadata.gz: 9c428d4bc1b6d9c64b5f1b78e9497acf5c9f035ab28bd35f8625f928e739ec08b8409454ac09f22e217c14a4c191211f775ded1c5eff9aff31de6a8168fd52a6
7
- data.tar.gz: f0486ea8fbe60cd7c6e6324e7e30b585ca71e47e23859943417cfcc0e4d3010ea3dd90347cc2805a828afd5d5e895f0357064138af984eb141163d150f626ad6
6
+ metadata.gz: df9cab2d6ecfaeacf8cf067b4d09ba05ceffcb1cbcae002d21a53387c55b1918bf3d7054386a97dcc54479267cddc21416adf05fa1c1af9955e4cfd6c85c1cd0
7
+ data.tar.gz: 55ad527a59e3a5bfac3c27b54493b40693055b91dbcb6df38acbb947b4c3cfea4cffe3a03bdb31747c31f30d666bbb0d27d549023d6d9e889307ef0ddfe7b1a6
data/lib/chainer.rb CHANGED
@@ -2,5 +2,7 @@
2
2
 
3
3
  # Allows to pipe Ruby calls in a nice way
4
4
  module Chainer
5
+ autoload :Class, 'chainer/class'
6
+ autoload :Method, 'chainer/method'
5
7
  autoload :VERSION, 'chainer/version'
6
8
  end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Chainer
4
+ # Pipes objects with +call+ method
5
+ class Class
6
+
7
+ # @!attribute [r] value
8
+ # @return [Object] Wrapped value
9
+ attr_reader :value
10
+
11
+ # Initializes pipe wrapper
12
+ #
13
+ # @param [Object, #call] value Value to be wrapped and sent to the next in the pipe
14
+ def initialize(value)
15
+ @value = value.is_a?(self.class) ? value.value : value
16
+ freeze
17
+ end
18
+
19
+ # @fn def >> object
20
+ # @brief The "pipe" operator. Calls passed +object+ with the wrapped +value+
21
+ #
22
+ # @param [#call] object Next object in the pipe which going to be called
23
+ #
24
+ # @return [self] Wrapped result of calculations
25
+ def >>(object) # rubocop:disable Style/OpMethod
26
+ self.class.new object.(value)
27
+ end
28
+
29
+ end
30
+ end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Chainer
4
-
5
4
  # Pipes method names on a context class
6
5
  class Method
7
6
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Chainer
4
4
  # Version of the gem
5
- VERSION = '0.0.1'
5
+ VERSION = '0.0.2'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chainer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Viktor Lazarev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-01 00:00:00.000000000 Z
11
+ date: 2017-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -73,6 +73,7 @@ extensions: []
73
73
  extra_rdoc_files: []
74
74
  files:
75
75
  - lib/chainer.rb
76
+ - lib/chainer/class.rb
76
77
  - lib/chainer/method.rb
77
78
  - lib/chainer/version.rb
78
79
  homepage: https://github.com/gentoid/chainer