simple-service 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/Makefile +5 -2
- data/TODO.txt +3 -0
- data/VERSION +1 -1
- data/doc/Simple.html +1 -1
- data/doc/Simple/Service.html +89 -87
- data/doc/Simple/Service/Action.html +59 -150
- data/doc/Simple/Service/Action/Comment.html +1 -1
- data/doc/Simple/Service/Action/Comment/Extractor.html +1 -1
- data/doc/Simple/Service/Action/MethodReflection.html +1 -1
- data/doc/Simple/Service/Action/Parameter.html +2 -2
- data/doc/Simple/Service/ArgumentError.html +1 -1
- data/doc/Simple/Service/ClassMethods.html +5 -5
- data/doc/Simple/Service/Context.html +5 -5
- data/doc/Simple/Service/ContextMissingError.html +1 -1
- data/doc/Simple/Service/ContextReadOnlyError.html +1 -1
- data/doc/Simple/Service/ExtraArguments.html +1 -1
- data/doc/Simple/Service/GemHelper.html +1 -1
- data/doc/Simple/Service/MissingArguments.html +1 -1
- data/doc/Simple/Service/NoSuchAction.html +1 -1
- data/doc/_index.html +7 -19
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +3 -3
- data/doc/file.TODO.html +70 -0
- data/doc/file_list.html +5 -0
- data/doc/index.html +3 -3
- data/doc/method_list.html +59 -115
- data/doc/top-level-namespace.html +1 -1
- data/lib/simple/service.rb +22 -1
- data/lib/simple/service/action/comment.rb +2 -0
- data/spec/simple/service/action_invoke_spec.rb +82 -11
- data/spec/simple/service/service_spec.rb +8 -6
- metadata +5 -4
- data/doc/Simple/Service/Action/IndieHash.html +0 -506
@@ -100,7 +100,7 @@
|
|
100
100
|
</div>
|
101
101
|
|
102
102
|
<div id="footer">
|
103
|
-
Generated on
|
103
|
+
Generated on Wed Dec 4 22:57:12 2019 by
|
104
104
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
105
105
|
0.9.20 (ruby-2.5.1).
|
106
106
|
</div>
|
data/lib/simple/service.rb
CHANGED
@@ -2,6 +2,7 @@ module Simple # @private
|
|
2
2
|
end
|
3
3
|
|
4
4
|
require "expectation"
|
5
|
+
require "logger"
|
5
6
|
|
6
7
|
require_relative "service/errors"
|
7
8
|
require_relative "service/action"
|
@@ -31,11 +32,14 @@ require_relative "service/version"
|
|
31
32
|
# end
|
32
33
|
#
|
33
34
|
# 2. <em>Discover services:</em> To discover services in a service module use the #actions method. This returns a Hash
|
34
|
-
# of actions.
|
35
|
+
# of actions.
|
35
36
|
#
|
36
37
|
# Simple::Service.actions(GodMode)
|
37
38
|
# => {:build_universe=>#<Simple::Service::Action...>, ...}
|
38
39
|
#
|
40
|
+
# TODO: why a Hash? It feels much better if Simple::Service.actions returns an array of names.
|
41
|
+
#
|
42
|
+
#
|
39
43
|
# 3. <em>Invoke a service:</em> run <tt>Simple::Service.invoke3</tt> or <tt>Simple::Service.invoke</tt>. You must set a context first.
|
40
44
|
#
|
41
45
|
# Simple::Service.with_context do
|
@@ -44,8 +48,25 @@ require_relative "service/version"
|
|
44
48
|
# => 42
|
45
49
|
#
|
46
50
|
module Simple::Service
|
51
|
+
module ServiceExpectations
|
52
|
+
def expect!(*args, &block)
|
53
|
+
Expectation.expect!(*args, &block)
|
54
|
+
rescue ::Expectation::Error => e
|
55
|
+
raise ArgumentError, e.to_s
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
47
59
|
def self.included(klass) # @private
|
48
60
|
klass.extend ClassMethods
|
61
|
+
klass.include ServiceExpectations
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.logger
|
65
|
+
@logger ||= ::Logger.new(STDOUT)
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.logger=(logger)
|
69
|
+
@logger = logger
|
49
70
|
end
|
50
71
|
|
51
72
|
# returns true if the passed in object is a service module.
|
@@ -15,7 +15,7 @@ describe "Simple::Service.invoke" do
|
|
15
15
|
let(:action) { nil }
|
16
16
|
|
17
17
|
# a shortcut
|
18
|
-
def invoke!(args
|
18
|
+
def invoke!(args: {}, flags: {})
|
19
19
|
@actual = ::Simple::Service.invoke(service, action, args: args, flags: flags)
|
20
20
|
# rescue ::StandardError => e
|
21
21
|
rescue ::Simple::Service::ArgumentError => e
|
@@ -42,7 +42,14 @@ describe "Simple::Service.invoke" do
|
|
42
42
|
|
43
43
|
context "calling with extra named args" do
|
44
44
|
it "ignores extra args" do
|
45
|
-
invoke!("foo" => "foo", "bar" => "bar")
|
45
|
+
invoke!(args: { "foo" => "foo", "bar" => "bar" })
|
46
|
+
expect(actual).to eq("service2 return")
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context "calling with extra flags" do
|
51
|
+
it "ignores extra args" do
|
52
|
+
invoke!(flags: { "foo" => "foo", "bar" => "bar" })
|
46
53
|
expect(actual).to eq("service2 return")
|
47
54
|
end
|
48
55
|
end
|
@@ -67,21 +74,28 @@ describe "Simple::Service.invoke" do
|
|
67
74
|
|
68
75
|
context "with the required number of args" do
|
69
76
|
it "runs" do
|
70
|
-
invoke!("a" => "foo", "b" => "bar")
|
77
|
+
invoke!(args: { "a" => "foo", "b" => "bar" })
|
78
|
+
expect(actual).to eq(["foo", "bar", "speed-of-light", 2.781])
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
context "with the required number of args and flags" do
|
83
|
+
it "merges flags and args to provide arguments" do
|
84
|
+
invoke!(args: { "a" => "foo" }, flags: { "b" => "bar" })
|
71
85
|
expect(actual).to eq(["foo", "bar", "speed-of-light", 2.781])
|
72
86
|
end
|
73
87
|
end
|
74
88
|
|
75
89
|
context "with the allowed number of args" do
|
76
90
|
it "runs" do
|
77
|
-
invoke!("a" => "foo", "b" => "bar", "c" => "baz", "e" => "number4")
|
91
|
+
invoke!(args: { "a" => "foo", "b" => "bar", "c" => "baz", "e" => "number4" })
|
78
92
|
expect(actual).to eq(%w[foo bar baz number4])
|
79
93
|
end
|
80
94
|
end
|
81
95
|
|
82
96
|
context "calling with extra named args" do
|
83
97
|
it "ignores extra args" do
|
84
|
-
invoke!("a" => "foo", "b" => "bar", "c" => "baz", "e" => "number4", "extra3" => 3)
|
98
|
+
invoke!(args: { "a" => "foo", "b" => "bar", "c" => "baz", "e" => "number4", "extra3" => 3 })
|
85
99
|
expect(actual).to eq(%w[foo bar baz number4])
|
86
100
|
end
|
87
101
|
end
|
@@ -106,21 +120,21 @@ describe "Simple::Service.invoke" do
|
|
106
120
|
|
107
121
|
context "with the required number of args" do
|
108
122
|
it "runs" do
|
109
|
-
invoke!("a" => "foo", "b" => "bar")
|
123
|
+
invoke!(args: { "a" => "foo", "b" => "bar" })
|
110
124
|
expect(actual).to eq(["foo", "bar", "speed-of-light", 2.781])
|
111
125
|
end
|
112
126
|
end
|
113
127
|
|
114
128
|
context "with the allowed number of args" do
|
115
129
|
it "runs" do
|
116
|
-
invoke!("a" => "foo", "b" => "bar", "c" => "baz", "e" => "number4")
|
130
|
+
invoke!(args: { "a" => "foo", "b" => "bar", "c" => "baz", "e" => "number4" })
|
117
131
|
expect(actual).to eq(%w[foo bar baz number4])
|
118
132
|
end
|
119
133
|
end
|
120
134
|
|
121
135
|
context "with extra named args" do
|
122
136
|
it "ignores extra args" do
|
123
|
-
invoke!("a" => "foo", "b" => "bar", "c" => "baz", "extra3" => 3)
|
137
|
+
invoke!(args: { "a" => "foo", "b" => "bar", "c" => "baz", "extra3" => 3 })
|
124
138
|
expect(actual).to eq(["foo", "bar", "baz", 2.781])
|
125
139
|
end
|
126
140
|
end
|
@@ -144,23 +158,80 @@ describe "Simple::Service.invoke" do
|
|
144
158
|
|
145
159
|
context "with the required number of args" do
|
146
160
|
it "runs" do
|
147
|
-
invoke!("a" => "foo")
|
161
|
+
invoke!(args: { "a" => "foo" })
|
148
162
|
expect(actual).to eq(["foo", "default-b", "speed-of-light", 2.781])
|
149
163
|
end
|
150
164
|
end
|
151
165
|
|
152
166
|
context "with the allowed number of args" do
|
153
167
|
it "runs" do
|
154
|
-
invoke!("a" => "foo", "b" => "bar", "c" => "baz", "e" => "number4")
|
168
|
+
invoke!(args: { "a" => "foo", "b" => "bar", "c" => "baz", "e" => "number4" })
|
155
169
|
expect(actual).to eq(%w[foo bar baz number4])
|
156
170
|
end
|
157
171
|
end
|
158
172
|
|
159
173
|
context "with extra named args" do
|
160
174
|
it "ignores extra args" do
|
161
|
-
invoke!("a" => "foo", "b" => "bar", "c" => "baz", "e" => "number4", "extra3" => 3)
|
175
|
+
invoke!(args: { "a" => "foo", "b" => "bar", "c" => "baz", "e" => "number4", "extra3" => 3 })
|
162
176
|
expect(actual).to eq(["foo", "bar", "baz", "number4"])
|
163
177
|
end
|
164
178
|
end
|
165
179
|
end
|
180
|
+
|
181
|
+
context "calling an action w/mixed and variadic parameters" do
|
182
|
+
# reminder: this is the definition of variadic_params
|
183
|
+
#
|
184
|
+
# def variadic_params(a, b = "queen bee", *args, e: 2.781)
|
185
|
+
# [a, b, args, e]
|
186
|
+
# end
|
187
|
+
|
188
|
+
let(:action) { :variadic_params }
|
189
|
+
|
190
|
+
context "without args" do
|
191
|
+
it "raises MissingArguments" do
|
192
|
+
invoke!
|
193
|
+
expect(actual).to be_a(::Simple::Service::MissingArguments)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
context "with the required number of args" do
|
198
|
+
it "runs" do
|
199
|
+
invoke!(args: { "a" => "foo" })
|
200
|
+
expect(actual).to eq(["foo", "queen bee", [], 2.781])
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
context "with the allowed number of args" do
|
205
|
+
it "runs" do
|
206
|
+
invoke!(args: { "a" => "foo", "b" => "bar", "args" => ["baz"] }, flags: { "e" => "number4" })
|
207
|
+
expect(actual).to eq(["foo", "bar", ["baz"], "number4"])
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
context "with variadic args" do
|
212
|
+
it "sends the variadic args from the args: parameter" do
|
213
|
+
invoke!(args: { "a" => "foo", "b" => "bar", "args" => ["baz", "extra"] }, flags: { "e" => "number4", "extra3" => 2 })
|
214
|
+
expect(actual).to eq(["foo", "bar", ["baz", "extra"], "number4"])
|
215
|
+
end
|
216
|
+
|
217
|
+
it "sends the variadic args from the flags: parameter" do
|
218
|
+
invoke!(args: { "a" => "foo", "b" => "bar" }, flags: { "args" => ["baz", "extra"], "e" => "number4", "extra3" => 2 })
|
219
|
+
expect(actual).to eq(["foo", "bar", ["baz", "extra"], "number4"])
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
describe "calling with symbolized Hashes" do
|
225
|
+
it "raises ArgumentError" do
|
226
|
+
hsh = { a: "foo", "b" => "KJH" }
|
227
|
+
|
228
|
+
expect do
|
229
|
+
invoke!(args: hsh)
|
230
|
+
end.to raise_error(Expectation::Matcher::Mismatch)
|
231
|
+
|
232
|
+
expect do
|
233
|
+
invoke!(flags: hsh)
|
234
|
+
end.to raise_error(Expectation::Matcher::Mismatch)
|
235
|
+
end
|
236
|
+
end
|
166
237
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
+
# rubocop:disable Style/WordArray
|
4
|
+
|
3
5
|
describe "Simple::Service" do
|
4
6
|
context "when running against a NoService module" do
|
5
7
|
let(:service) { NoServiceModule }
|
@@ -76,7 +78,7 @@ describe "Simple::Service" do
|
|
76
78
|
end
|
77
79
|
end
|
78
80
|
|
79
|
-
describe
|
81
|
+
describe ".invoke3" do
|
80
82
|
def invoke3
|
81
83
|
Simple::Service.invoke3(service, :service1, "my_a", "my_b", d: "my_d")
|
82
84
|
end
|
@@ -146,11 +148,11 @@ describe "Simple::Service" do
|
|
146
148
|
it "calls Action#invoke with the right arguments" do
|
147
149
|
expected = ["bar-value", "baz-value"]
|
148
150
|
::Simple::Service.with_context do
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
151
|
+
expect(invoke3("bar-value", baz: "baz-value")).to eq(expected)
|
152
|
+
expect(invoke3(bar: "bar-value", baz: "baz-value")).to eq(expected)
|
153
|
+
expect(invoke(args: ["bar-value"], flags: { "baz" => "baz-value" })).to eq(expected)
|
154
|
+
expect(invoke(args: { "bar" => "bar-value", "baz" => "baz-value" })).to eq(expected)
|
155
|
+
end
|
154
156
|
end
|
155
157
|
end
|
156
158
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple-service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- radiospiel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: expectation
|
@@ -37,6 +37,7 @@ files:
|
|
37
37
|
- Makefile
|
38
38
|
- README.md
|
39
39
|
- Rakefile
|
40
|
+
- TODO.txt
|
40
41
|
- VERSION
|
41
42
|
- bin/bundle
|
42
43
|
- bin/console
|
@@ -47,7 +48,6 @@ files:
|
|
47
48
|
- doc/Simple/Service/Action.html
|
48
49
|
- doc/Simple/Service/Action/Comment.html
|
49
50
|
- doc/Simple/Service/Action/Comment/Extractor.html
|
50
|
-
- doc/Simple/Service/Action/IndieHash.html
|
51
51
|
- doc/Simple/Service/Action/MethodReflection.html
|
52
52
|
- doc/Simple/Service/Action/Parameter.html
|
53
53
|
- doc/Simple/Service/ArgumentError.html
|
@@ -65,6 +65,7 @@ files:
|
|
65
65
|
- doc/css/full_list.css
|
66
66
|
- doc/css/style.css
|
67
67
|
- doc/file.README.html
|
68
|
+
- doc/file.TODO.html
|
68
69
|
- doc/file_list.html
|
69
70
|
- doc/frames.html
|
70
71
|
- doc/index.html
|
@@ -114,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
115
|
- !ruby/object:Gem::Version
|
115
116
|
version: '0'
|
116
117
|
requirements: []
|
117
|
-
rubygems_version: 3.0.
|
118
|
+
rubygems_version: 3.0.6
|
118
119
|
signing_key:
|
119
120
|
specification_version: 4
|
120
121
|
summary: Pretty simple and somewhat abstract service description
|
@@ -1,506 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta charset="utf-8">
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
-
<title>
|
7
|
-
Class: Simple::Service::Action::IndieHash
|
8
|
-
|
9
|
-
— Documentation by YARD 0.9.20
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="../../../css/style.css" type="text/css" charset="utf-8" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="../../../css/common.css" type="text/css" charset="utf-8" />
|
16
|
-
|
17
|
-
<script type="text/javascript" charset="utf-8">
|
18
|
-
pathId = "Simple::Service::Action::IndieHash";
|
19
|
-
relpath = '../../../';
|
20
|
-
</script>
|
21
|
-
|
22
|
-
|
23
|
-
<script type="text/javascript" charset="utf-8" src="../../../js/jquery.js"></script>
|
24
|
-
|
25
|
-
<script type="text/javascript" charset="utf-8" src="../../../js/app.js"></script>
|
26
|
-
|
27
|
-
|
28
|
-
</head>
|
29
|
-
<body>
|
30
|
-
<div class="nav_wrap">
|
31
|
-
<iframe id="nav" src="../../../class_list.html?1"></iframe>
|
32
|
-
<div id="resizer"></div>
|
33
|
-
</div>
|
34
|
-
|
35
|
-
<div id="main" tabindex="-1">
|
36
|
-
<div id="header">
|
37
|
-
<div id="menu">
|
38
|
-
|
39
|
-
<a href="../../../_index.html">Index (I)</a> »
|
40
|
-
<span class='title'><span class='object_link'><a href="../../../Simple.html" title="Simple (module)">Simple</a></span></span> » <span class='title'><span class='object_link'><a href="../../Service.html" title="Simple::Service (module)">Service</a></span></span> » <span class='title'><span class='object_link'><a href="../Action.html" title="Simple::Service::Action (class)">Action</a></span></span>
|
41
|
-
»
|
42
|
-
<span class="title">IndieHash</span>
|
43
|
-
|
44
|
-
</div>
|
45
|
-
|
46
|
-
<div id="search">
|
47
|
-
|
48
|
-
<a class="full_list_link" id="class_list_link"
|
49
|
-
href="../../../class_list.html">
|
50
|
-
|
51
|
-
<svg width="24" height="24">
|
52
|
-
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
-
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
-
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
-
</svg>
|
56
|
-
</a>
|
57
|
-
|
58
|
-
</div>
|
59
|
-
<div class="clear"></div>
|
60
|
-
</div>
|
61
|
-
|
62
|
-
<div id="content"><h1>Class: Simple::Service::Action::IndieHash
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
</h1>
|
67
|
-
<div class="box_info">
|
68
|
-
|
69
|
-
<dl>
|
70
|
-
<dt>Inherits:</dt>
|
71
|
-
<dd>
|
72
|
-
<span class="inheritName">Object</span>
|
73
|
-
|
74
|
-
<ul class="fullTree">
|
75
|
-
<li>Object</li>
|
76
|
-
|
77
|
-
<li class="next">Simple::Service::Action::IndieHash</li>
|
78
|
-
|
79
|
-
</ul>
|
80
|
-
<a href="#" class="inheritanceTree">show all</a>
|
81
|
-
|
82
|
-
</dd>
|
83
|
-
</dl>
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
<dl>
|
96
|
-
<dt>Defined in:</dt>
|
97
|
-
<dd>lib/simple/service/action/indie_hash.rb</dd>
|
98
|
-
</dl>
|
99
|
-
|
100
|
-
</div>
|
101
|
-
|
102
|
-
<h2>Overview</h2><div class="docstring">
|
103
|
-
<div class="discussion">
|
104
|
-
|
105
|
-
<p>The IndieHash class defines as much of the Hash interface as necessary for simple-service to successfully run.</p>
|
106
|
-
|
107
|
-
|
108
|
-
</div>
|
109
|
-
</div>
|
110
|
-
<div class="tags">
|
111
|
-
|
112
|
-
|
113
|
-
</div>
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
<h2>
|
122
|
-
Instance Method Summary
|
123
|
-
<small><a href="#" class="summary_toggle">collapse</a></small>
|
124
|
-
</h2>
|
125
|
-
|
126
|
-
<ul class="summary">
|
127
|
-
|
128
|
-
<li class="public ">
|
129
|
-
<span class="summary_signature">
|
130
|
-
|
131
|
-
<a href="#[]-instance_method" title="#[] (instance method)">#<strong>[]</strong>(sym) ⇒ Object </a>
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
</span>
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
146
|
-
|
147
|
-
</li>
|
148
|
-
|
149
|
-
|
150
|
-
<li class="public ">
|
151
|
-
<span class="summary_signature">
|
152
|
-
|
153
|
-
<a href="#fetch_values-instance_method" title="#fetch_values (instance method)">#<strong>fetch_values</strong>(*keys) ⇒ Object </a>
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
</span>
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
168
|
-
|
169
|
-
</li>
|
170
|
-
|
171
|
-
|
172
|
-
<li class="public ">
|
173
|
-
<span class="summary_signature">
|
174
|
-
|
175
|
-
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(hsh) ⇒ IndieHash </a>
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
</span>
|
180
|
-
|
181
|
-
|
182
|
-
<span class="note title constructor">constructor</span>
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
<span class="summary_desc"><div class='inline'>
|
192
|
-
<p>A new instance of IndieHash.</p>
|
193
|
-
</div></span>
|
194
|
-
|
195
|
-
</li>
|
196
|
-
|
197
|
-
|
198
|
-
<li class="public ">
|
199
|
-
<span class="summary_signature">
|
200
|
-
|
201
|
-
<a href="#key%3F-instance_method" title="#key? (instance method)">#<strong>key?</strong>(sym) ⇒ Boolean </a>
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
</span>
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
216
|
-
|
217
|
-
</li>
|
218
|
-
|
219
|
-
|
220
|
-
<li class="public ">
|
221
|
-
<span class="summary_signature">
|
222
|
-
|
223
|
-
<a href="#keys-instance_method" title="#keys (instance method)">#<strong>keys</strong> ⇒ Object </a>
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
</span>
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
238
|
-
|
239
|
-
</li>
|
240
|
-
|
241
|
-
|
242
|
-
<li class="public ">
|
243
|
-
<span class="summary_signature">
|
244
|
-
|
245
|
-
<a href="#merge-instance_method" title="#merge (instance method)">#<strong>merge</strong>(other_hsh) ⇒ Object </a>
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
</span>
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
260
|
-
|
261
|
-
</li>
|
262
|
-
|
263
|
-
|
264
|
-
</ul>
|
265
|
-
|
266
|
-
|
267
|
-
<div id="constructor_details" class="method_details_list">
|
268
|
-
<h2>Constructor Details</h2>
|
269
|
-
|
270
|
-
<div class="method_details first">
|
271
|
-
<h3 class="signature first" id="initialize-instance_method">
|
272
|
-
|
273
|
-
#<strong>initialize</strong>(hsh) ⇒ <tt><span class='object_link'><a href="" title="Simple::Service::Action::IndieHash (class)">IndieHash</a></span></tt>
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
</h3><div class="docstring">
|
280
|
-
<div class="discussion">
|
281
|
-
|
282
|
-
<p>Returns a new instance of IndieHash</p>
|
283
|
-
|
284
|
-
|
285
|
-
</div>
|
286
|
-
</div>
|
287
|
-
<div class="tags">
|
288
|
-
|
289
|
-
|
290
|
-
</div><table class="source_code">
|
291
|
-
<tr>
|
292
|
-
<td>
|
293
|
-
<pre class="lines">
|
294
|
-
|
295
|
-
|
296
|
-
5
|
297
|
-
6
|
298
|
-
7</pre>
|
299
|
-
</td>
|
300
|
-
<td>
|
301
|
-
<pre class="code"><span class="info file"># File 'lib/simple/service/action/indie_hash.rb', line 5</span>
|
302
|
-
|
303
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_hsh'>hsh</span><span class='rparen'>)</span>
|
304
|
-
<span class='ivar'>@hsh</span> <span class='op'>=</span> <span class='id identifier rubyid_hsh'>hsh</span><span class='period'>.</span><span class='id identifier rubyid_each_with_object'>each_with_object</span><span class='lparen'>(</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='lparen'>(</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_h'>h</span><span class='op'>|</span> <span class='id identifier rubyid_h'>h</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span> <span class='rbrace'>}</span>
|
305
|
-
<span class='kw'>end</span></pre>
|
306
|
-
</td>
|
307
|
-
</tr>
|
308
|
-
</table>
|
309
|
-
</div>
|
310
|
-
|
311
|
-
</div>
|
312
|
-
|
313
|
-
|
314
|
-
<div id="instance_method_details" class="method_details_list">
|
315
|
-
<h2>Instance Method Details</h2>
|
316
|
-
|
317
|
-
|
318
|
-
<div class="method_details first">
|
319
|
-
<h3 class="signature first" id="[]-instance_method">
|
320
|
-
|
321
|
-
#<strong>[]</strong>(sym) ⇒ <tt>Object</tt>
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
</h3><table class="source_code">
|
328
|
-
<tr>
|
329
|
-
<td>
|
330
|
-
<pre class="lines">
|
331
|
-
|
332
|
-
|
333
|
-
22
|
334
|
-
23
|
335
|
-
24</pre>
|
336
|
-
</td>
|
337
|
-
<td>
|
338
|
-
<pre class="code"><span class="info file"># File 'lib/simple/service/action/indie_hash.rb', line 22</span>
|
339
|
-
|
340
|
-
<span class='kw'>def</span> <span class='op'>[]</span><span class='lparen'>(</span><span class='id identifier rubyid_sym'>sym</span><span class='rparen'>)</span>
|
341
|
-
<span class='ivar'>@hsh</span><span class='lbracket'>[</span><span class='id identifier rubyid_sym'>sym</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rbracket'>]</span>
|
342
|
-
<span class='kw'>end</span></pre>
|
343
|
-
</td>
|
344
|
-
</tr>
|
345
|
-
</table>
|
346
|
-
</div>
|
347
|
-
|
348
|
-
<div class="method_details ">
|
349
|
-
<h3 class="signature " id="fetch_values-instance_method">
|
350
|
-
|
351
|
-
#<strong>fetch_values</strong>(*keys) ⇒ <tt>Object</tt>
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
</h3><table class="source_code">
|
358
|
-
<tr>
|
359
|
-
<td>
|
360
|
-
<pre class="lines">
|
361
|
-
|
362
|
-
|
363
|
-
13
|
364
|
-
14
|
365
|
-
15
|
366
|
-
16</pre>
|
367
|
-
</td>
|
368
|
-
<td>
|
369
|
-
<pre class="code"><span class="info file"># File 'lib/simple/service/action/indie_hash.rb', line 13</span>
|
370
|
-
|
371
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_fetch_values'>fetch_values</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_keys'>keys</span><span class='rparen'>)</span>
|
372
|
-
<span class='id identifier rubyid_keys'>keys</span> <span class='op'>=</span> <span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:to_s</span><span class='rparen'>)</span>
|
373
|
-
<span class='ivar'>@hsh</span><span class='period'>.</span><span class='id identifier rubyid_fetch_values'>fetch_values</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_keys'>keys</span><span class='rparen'>)</span>
|
374
|
-
<span class='kw'>end</span></pre>
|
375
|
-
</td>
|
376
|
-
</tr>
|
377
|
-
</table>
|
378
|
-
</div>
|
379
|
-
|
380
|
-
<div class="method_details ">
|
381
|
-
<h3 class="signature " id="key?-instance_method">
|
382
|
-
|
383
|
-
#<strong>key?</strong>(sym) ⇒ <tt>Boolean</tt>
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
</h3><div class="docstring">
|
390
|
-
<div class="discussion">
|
391
|
-
|
392
|
-
|
393
|
-
</div>
|
394
|
-
</div>
|
395
|
-
<div class="tags">
|
396
|
-
|
397
|
-
<p class="tag_title">Returns:</p>
|
398
|
-
<ul class="return">
|
399
|
-
|
400
|
-
<li>
|
401
|
-
|
402
|
-
|
403
|
-
<span class='type'>(<tt>Boolean</tt>)</span>
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
</li>
|
408
|
-
|
409
|
-
</ul>
|
410
|
-
|
411
|
-
</div><table class="source_code">
|
412
|
-
<tr>
|
413
|
-
<td>
|
414
|
-
<pre class="lines">
|
415
|
-
|
416
|
-
|
417
|
-
18
|
418
|
-
19
|
419
|
-
20</pre>
|
420
|
-
</td>
|
421
|
-
<td>
|
422
|
-
<pre class="code"><span class="info file"># File 'lib/simple/service/action/indie_hash.rb', line 18</span>
|
423
|
-
|
424
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='id identifier rubyid_sym'>sym</span><span class='rparen'>)</span>
|
425
|
-
<span class='ivar'>@hsh</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='id identifier rubyid_sym'>sym</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
|
426
|
-
<span class='kw'>end</span></pre>
|
427
|
-
</td>
|
428
|
-
</tr>
|
429
|
-
</table>
|
430
|
-
</div>
|
431
|
-
|
432
|
-
<div class="method_details ">
|
433
|
-
<h3 class="signature " id="keys-instance_method">
|
434
|
-
|
435
|
-
#<strong>keys</strong> ⇒ <tt>Object</tt>
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
</h3><table class="source_code">
|
442
|
-
<tr>
|
443
|
-
<td>
|
444
|
-
<pre class="lines">
|
445
|
-
|
446
|
-
|
447
|
-
9
|
448
|
-
10
|
449
|
-
11</pre>
|
450
|
-
</td>
|
451
|
-
<td>
|
452
|
-
<pre class="code"><span class="info file"># File 'lib/simple/service/action/indie_hash.rb', line 9</span>
|
453
|
-
|
454
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_keys'>keys</span>
|
455
|
-
<span class='ivar'>@hsh</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span>
|
456
|
-
<span class='kw'>end</span></pre>
|
457
|
-
</td>
|
458
|
-
</tr>
|
459
|
-
</table>
|
460
|
-
</div>
|
461
|
-
|
462
|
-
<div class="method_details ">
|
463
|
-
<h3 class="signature " id="merge-instance_method">
|
464
|
-
|
465
|
-
#<strong>merge</strong>(other_hsh) ⇒ <tt>Object</tt>
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
</h3><table class="source_code">
|
472
|
-
<tr>
|
473
|
-
<td>
|
474
|
-
<pre class="lines">
|
475
|
-
|
476
|
-
|
477
|
-
26
|
478
|
-
27
|
479
|
-
28
|
480
|
-
29</pre>
|
481
|
-
</td>
|
482
|
-
<td>
|
483
|
-
<pre class="code"><span class="info file"># File 'lib/simple/service/action/indie_hash.rb', line 26</span>
|
484
|
-
|
485
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_other_hsh'>other_hsh</span><span class='rparen'>)</span>
|
486
|
-
<span class='ivar'>@hsh</span> <span class='op'>=</span> <span class='ivar'>@hsh</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_other_hsh'>other_hsh</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='symbol'>:__hsh__</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
487
|
-
<span class='kw'>self</span>
|
488
|
-
<span class='kw'>end</span></pre>
|
489
|
-
</td>
|
490
|
-
</tr>
|
491
|
-
</table>
|
492
|
-
</div>
|
493
|
-
|
494
|
-
</div>
|
495
|
-
|
496
|
-
</div>
|
497
|
-
|
498
|
-
<div id="footer">
|
499
|
-
Generated on Tue Dec 3 13:46:26 2019 by
|
500
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
501
|
-
0.9.20 (ruby-2.5.1).
|
502
|
-
</div>
|
503
|
-
|
504
|
-
</div>
|
505
|
-
</body>
|
506
|
-
</html>
|