template_params_rails 0.1.1 → 0.1.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: 73a0070b22cf745aaedbf77b10e308e3c18a839b
4
- data.tar.gz: acbd3ddb5d9e48a11931a20dcdc0e9343912ec4c
3
+ metadata.gz: 94a5d2a3fb35eee0dc473833b53b945700eabc40
4
+ data.tar.gz: 51e6ccaa7cc4b71a027ba8bdd0b8d415d7969a86
5
5
  SHA512:
6
- metadata.gz: 9f8a0889f5c2a9501777a06dc4aa4f7c45e406c2c01234b5a110e9f9b83c1d4adc7807b5291ff4f649b3ea7b0d07f9eac30d917c57cbaf5dc7516825848a0e95
7
- data.tar.gz: 6a0efcee4b5539d3c494ab3d11d9fbbbee73853ffe38032d866ec1236fd2baf43529e35401b7d669b0f3db8ff7be16c165ec0954cceda3defee66579bfd488e0
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
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/template_params_rails`. To experiment with that code, run `bin/console` for an interactive prompt.
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
- TODO: Write usage instructions here
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
- ## Development
33
+ # Assert `@course` is defined. Meaningless because instance variables are
34
+ # always defined.
35
+ template_param { @course }
28
36
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
37
+ # Assert `poll.is_a?(::Poll)`. If not, raises a `TypeError`.
38
+ template_param(::Poll) { poll }
30
39
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
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/[USERNAME]/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.
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
@@ -1,3 +1,3 @@
1
1
  module TemplateParamsRails
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -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.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-07-22 00:00:00.000000000 Z
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: '0'
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: '0'
26
+ version: 0.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement