template_params_rails 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +22 -9
- data/lib/template_params_rails/version.rb +1 -1
- data/template_params_rails.gemspec +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94a5d2a3fb35eee0dc473833b53b945700eabc40
|
4
|
+
data.tar.gz: 51e6ccaa7cc4b71a027ba8bdd0b8d415d7969a86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df8838534ff186f57af4cbdb6917245f71be792196169b3b1c33129360dc1f80f6e545c2d5bbf9add7b4bfdf8053d3fadcfb566ee976b88bfee353f47c8ad593
|
7
|
+
data.tar.gz: 5b8bb677a53cb3c6702acc5217c7fb2d2846911e0d215abccccad5e6a02760c5d1f5e90edbc420d63c38ec4eda274fdb0abb2af7597d675364f93f0123463fa6
|
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# TemplateParamsRails
|
2
|
+
Runtime type-check for template preconditions, including instance variables
|
3
|
+
and local variables. Think of this as the method signature of a template.
|
4
|
+
There should be at least one of these assertions in almost every template.
|
2
5
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
|
-
|
6
|
+
template_params_rails project integrates [template_params](https://github.com/jaredbeck/template_params) for rails.
|
7
7
|
## Installation
|
8
8
|
|
9
9
|
Add this line to your application's Gemfile:
|
@@ -22,17 +22,30 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
In template, you may want use template_param like this:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
|
29
|
+
# Assert `poll` is defined. If not, raises an `ArgumentError` (the "arguments"
|
30
|
+
# of the template are invalid).
|
31
|
+
template_param { poll }
|
26
32
|
|
27
|
-
|
33
|
+
# Assert `@course` is defined. Meaningless because instance variables are
|
34
|
+
# always defined.
|
35
|
+
template_param { @course }
|
28
36
|
|
29
|
-
|
37
|
+
# Assert `poll.is_a?(::Poll)`. If not, raises a `TypeError`.
|
38
|
+
template_param(::Poll) { poll }
|
30
39
|
|
31
|
-
|
40
|
+
# Assert `@course.is_a?(::Course)`
|
41
|
+
template_param(::Course) { @course }
|
32
42
|
|
43
|
+
# Assert `@course` is either a `::Course` or `nil`
|
44
|
+
template_param(::Course, allow_nil: true) { @course }
|
45
|
+
```
|
33
46
|
## Contributing
|
34
47
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
48
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/opodartho/template_params_rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
49
|
|
37
50
|
|
38
51
|
## License
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_runtime_dependency "template_params"
|
21
|
+
spec.add_runtime_dependency "template_params", "~> 0.1.0"
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.12"
|
24
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: template_params_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zahidul Haque
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: template_params
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.1.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 0.1.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|