sho 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +10 -0
- data/README.md +2 -2
- data/lib/sho/configurator.rb +2 -2
- data/lib/sho/version.rb +1 -1
- metadata +12 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6824fa2e826773658bce36e4f33d23715d62651b
|
4
|
+
data.tar.gz: fbe63cdf11cc334f60d87558c0996e6e55614113
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac5a8af9cf6047cbcfdbada0732738fa4802b1c3defd84a25fb352bfa2f49ed269a459f80571bbb54cb3811eb6f08ea2865e9051322069ac9d6e25b1979f7c9c
|
7
|
+
data.tar.gz: 2049bebaa82fcef22b3ac50c82aeafe86b1cb72b201c9b8a6a5c3f4f38dc2101738e20932bc0e2b89e4c149070def8d89734f1af0f62205532cd856efd3fae2b
|
data/Changelog.md
ADDED
data/README.md
CHANGED
@@ -48,8 +48,8 @@ You can think about the template as a _method body_, which immediately answers a
|
|
48
48
|
* **How do I test it? How do I set all the context for testing?** Just as with regular method: just create an instance, and call the method, and test the result.
|
49
49
|
* **But where do I put this method?** Wherever you wish! Sho does NOT insist on any particular architecture or code layout, which means you can experiment and evaluate several options, like:
|
50
50
|
* embed rendering in controller/Sinatra app (or even model, if you want to be really naughty today!) for the very first 30-lines-long prototype, then move it elsewhere (like "Extract Method" refactoring pattern, you know?)
|
51
|
-
* embed rendering in your service (operation) objects, so
|
52
|
-
* make Users::List class with `#html`, `#atom` and `#json` methods and use it like `Users::List.new(scope).send(request.format)` or `User::List.send(request.format, scope)`
|
51
|
+
* embed rendering in your service (operation) objects, so corresponding forms and buttons would be nested in the operation, and reused in other places like `Product::Create.new(current_user).button`
|
52
|
+
* make `Users::List` class with `#html`, `#atom` and `#json` methods and use it like `Users::List.new(scope).send(request.format)` or `User::List.send(request.format, scope)`
|
53
53
|
* make `Trailblazer::Cells`-like one-class-per-template objects to call them like `Users::HtmlList.new(scope).()`
|
54
54
|
* ...switch between several of the approaches, or even combine them in the same app!
|
55
55
|
|
data/lib/sho/configurator.rb
CHANGED
@@ -113,12 +113,12 @@ module Sho
|
|
113
113
|
|
114
114
|
def define_template_method(name, tilt, mandatory, optional, layout)
|
115
115
|
arguments = ArgumentValidator.new(*mandatory, **optional)
|
116
|
-
@host.__send__(:define_method, name) do |**locals|
|
116
|
+
@host.__send__(:define_method, name) do |**locals, &block|
|
117
117
|
locals = arguments.call(**locals)
|
118
118
|
if layout
|
119
119
|
__send__(layout) { tilt.render(self, **locals) }
|
120
120
|
else
|
121
|
-
tilt.render(self, **locals)
|
121
|
+
tilt.render(self, **locals, &block)
|
122
122
|
end
|
123
123
|
end
|
124
124
|
end
|
data/lib/sho/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sho
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Shepelev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tilt
|
@@ -154,30 +154,30 @@ dependencies:
|
|
154
154
|
name: rubocop
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- - "
|
157
|
+
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
159
|
+
version: 0.57.2
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- - "
|
164
|
+
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
166
|
+
version: 0.57.2
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: rubocop-rspec
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- - "
|
171
|
+
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
173
|
+
version: 1.27.0
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- - "
|
178
|
+
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version:
|
180
|
+
version: 1.27.0
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: rake
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -214,6 +214,7 @@ executables: []
|
|
214
214
|
extensions: []
|
215
215
|
extra_rdoc_files: []
|
216
216
|
files:
|
217
|
+
- Changelog.md
|
217
218
|
- README.md
|
218
219
|
- lib/sho.rb
|
219
220
|
- lib/sho/argument_validator.rb
|
@@ -239,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
239
240
|
version: '0'
|
240
241
|
requirements: []
|
241
242
|
rubyforge_project:
|
242
|
-
rubygems_version: 2.6.
|
243
|
+
rubygems_version: 2.6.10
|
243
244
|
signing_key:
|
244
245
|
specification_version: 4
|
245
246
|
summary: Experimental post-framework view library
|