bsflow 2.2.0 → 2.3.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 +4 -4
- data/README.md +111 -0
- data/lib/bsflow/square_brackets_adapter.rb +11 -0
- data/lib/bsflow/stdin_adapter.rb +11 -0
- data/lib/bsflow/stdout_adapter.rb +11 -0
- data/lib/bsflow/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6787213121edc5fc781e1a234343ddf26eb337b28c7085d8349b0c056118a58a
|
4
|
+
data.tar.gz: f81bc9bb45ebdc770950b1f6d54e39a490c45342552d84df0b21f1ed7d8ad927
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1445972cb93c36c99a547aca6a0aa1ff3ee000fbab77842eaa9461ae0c381efbde28507663f9c21a97a7a1579e3b4ff14c237051516e00ee94bbc9317d055a75
|
7
|
+
data.tar.gz: f30828ff0362ce63b34cac3e6e79f1cc5716be2adc47cb0341561d383e9746bf298b67449cb22db0de88f302252ec5a5bb7cc24b1989b34fcfb272d9090d4eb0
|
data/README.md
CHANGED
@@ -88,6 +88,117 @@ Paramaters:
|
|
88
88
|
- **_procs_** - an array of procs or objects responding on `.call` message. The first **_proc_** takes the "main" input of the class (any number of arguments). The result is passed to the next **_proc_** as input. The output of the last **_proc_** is the output of `.call` method of **Pipeline** class.
|
89
89
|
|
90
90
|
|
91
|
+
### Class BSFlow::StdoutAdapter
|
92
|
+
|
93
|
+
It allows to "connect" standard output stream to an object that expects `#call` mathod.
|
94
|
+
|
95
|
+
Source code:
|
96
|
+
|
97
|
+
```ruby
|
98
|
+
module BSFlow
|
99
|
+
class StdoutAdapter
|
100
|
+
def initialize(stdout:)
|
101
|
+
@stdout = stdout
|
102
|
+
end
|
103
|
+
|
104
|
+
def call(string)
|
105
|
+
@stdout.puts(string)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
```
|
110
|
+
|
111
|
+
#### Require
|
112
|
+
|
113
|
+
```ruby
|
114
|
+
require "bsflow/stdout_adapter"
|
115
|
+
```
|
116
|
+
|
117
|
+
#### Constructor
|
118
|
+
|
119
|
+
```ruby
|
120
|
+
BSFlow:StdoutAdapter.new(procs: procs) # => new_adapter
|
121
|
+
```
|
122
|
+
|
123
|
+
Paramaters:
|
124
|
+
|
125
|
+
- **_stdout_** - an object that respond to `.#puts` message with one argument.
|
126
|
+
|
127
|
+
|
128
|
+
### Class BSFlow::StdinAdapter
|
129
|
+
|
130
|
+
It allows to "connect" standard input stream to an object that expects `#call` mathod.
|
131
|
+
|
132
|
+
Source code:
|
133
|
+
|
134
|
+
```ruby
|
135
|
+
module BSFlow
|
136
|
+
class StdinAdapter
|
137
|
+
def initialize(stdin:)
|
138
|
+
@stdin = stdin
|
139
|
+
end
|
140
|
+
|
141
|
+
def call()
|
142
|
+
@stdin.gets.chomp
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
```
|
147
|
+
|
148
|
+
#### Require
|
149
|
+
|
150
|
+
```ruby
|
151
|
+
require "bsflow/stdin_adapter"
|
152
|
+
```
|
153
|
+
|
154
|
+
#### Constructor
|
155
|
+
|
156
|
+
```ruby
|
157
|
+
BSFlow:StdinAdapter.new(stdin: stdin) # => new_adapter
|
158
|
+
```
|
159
|
+
|
160
|
+
Paramaters:
|
161
|
+
|
162
|
+
- **_stdin_** - an object that respond to `.#gets` message. The chomped output of this object is the output of `.call` method of **StdinAdapter** class.
|
163
|
+
|
164
|
+
|
165
|
+
### Class BSFlow::SquareBracketsAdapter
|
166
|
+
|
167
|
+
It passes a value to **_[]_** method of a hash or any objects that response to [] method.
|
168
|
+
|
169
|
+
Source code:
|
170
|
+
|
171
|
+
```ruby
|
172
|
+
module BSFlow
|
173
|
+
class SquareBracketsAdapter
|
174
|
+
def initialize(map:)
|
175
|
+
@map = map
|
176
|
+
end
|
177
|
+
|
178
|
+
def call(symbol)
|
179
|
+
@map[symbol]
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
```
|
184
|
+
|
185
|
+
#### Require
|
186
|
+
|
187
|
+
```ruby
|
188
|
+
require "bsflow/square_brackets_adapter"
|
189
|
+
```
|
190
|
+
|
191
|
+
#### Constructor
|
192
|
+
|
193
|
+
```ruby
|
194
|
+
BSFlow:SquareBracketsAdapter.new(map: map) # => new_square_brackets_adapter
|
195
|
+
```
|
196
|
+
|
197
|
+
Paramaters:
|
198
|
+
|
199
|
+
- **_map_** - an object that respond to `.#[]` message. It takes the "main" input of the class (one argument). The output of this object is the output of `.call` method of **SquareBracketsAdapter** class.
|
200
|
+
|
201
|
+
|
91
202
|
### Class BSFlow::FirstArg
|
92
203
|
|
93
204
|
It just returns first pased argument and ignores the rest. Used to reduce number of arguments.
|
data/lib/bsflow/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bsflow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bartłomiej Sielski
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -78,6 +78,9 @@ files:
|
|
78
78
|
- lib/bsflow/pass.rb
|
79
79
|
- lib/bsflow/pipeline.rb
|
80
80
|
- lib/bsflow/self.rb
|
81
|
+
- lib/bsflow/square_brackets_adapter.rb
|
82
|
+
- lib/bsflow/stdin_adapter.rb
|
83
|
+
- lib/bsflow/stdout_adapter.rb
|
81
84
|
- lib/bsflow/true.rb
|
82
85
|
- lib/bsflow/until_true_loop.rb
|
83
86
|
- lib/bsflow/version.rb
|