params_for 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e0dbdd78b6a02ac4ceed14c171469d058e2563c7
4
- data.tar.gz: 27ae31f222ad064a9e1a991510f29d2f797f98c2
3
+ metadata.gz: f8cef79cc5641a6860e4df2ad3adb4ad2fd1fa42
4
+ data.tar.gz: 240969f6a63bd4e3a9a7376d0ab7e2458dcc6ae5
5
5
  SHA512:
6
- metadata.gz: d863599ede3d87d9a7554a138119512fa6a168a05b45c56b28bf1e47946ea649dba49b2405553588566022b97e116ec38c174e99365bd7127f09cae5828a9996
7
- data.tar.gz: 0a774e716966a38dd460e15907ffae3bb515b6f4d9512f4bd8590bb15cedbb76f6164e14a04872c77308af696c0aa254d26aa4ceb5016017d111b5e7dc95f075
6
+ metadata.gz: 122bea292a672b722ad98fabdfe7d59cf48e9e8f463334d888db18b434840bdeb4623115903c9340cb679499832540f12d695e282cfbf983a494698a9f7fc6ce
7
+ data.tar.gz: 70e50ac65ff040047f015a73ab05557a4f1938887b2b15611e09b0cf670da61795d7b0a0a2e18e7842214af9e5b19fbd07ed6d9778a7ea3dcbe60d11fd57063c
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in params_validator.gemspec
3
+ # Specify your gem's dependencies in params_for.gemspec
4
4
  gemspec
data/README.md CHANGED
@@ -16,7 +16,7 @@ And then execute:
16
16
 
17
17
  Or install it yourself as:
18
18
 
19
- $ gem install params_validator
19
+ $ gem install params_for
20
20
 
21
21
  ## Usage
22
22
 
@@ -27,7 +27,7 @@ In your controller:
27
27
  # app/controllers/fancy_controller.rb
28
28
 
29
29
  class Fancycontroller < ApplicationController
30
- include ParamsValidator::Connectors::ParamsFor
30
+ include ParamsFor::Connectors::Glue
31
31
 
32
32
  params_for :fancy, only: [:create]
33
33
 
@@ -48,7 +48,7 @@ Or you can play with it yourself
48
48
  # app/controllers/fancy_controller.rb
49
49
 
50
50
  class Fancycontroller < ApplicationController
51
- include ParamsValidator::Connectors::ParamsFor
51
+ include ParamsFor::Connectors::Glue
52
52
 
53
53
  # Creates a Fancy object by checking and validating params
54
54
  # before that
@@ -71,7 +71,7 @@ class Fancycontroller < ApplicationController
71
71
  end
72
72
  ```
73
73
 
74
- Some place in your application ( suggested `app/validators/params_validator/` )
74
+ Some place in your application ( suggested `app/validators/params_for/` )
75
75
 
76
76
  ```Ruby
77
77
  # app/validators/param_validator/fancy.rb
@@ -86,7 +86,7 @@ Some place in your application ( suggested `app/validators/params_validator/` )
86
86
 
87
87
  ## Contributing
88
88
 
89
- 1. Fork it ( https://github.com/[my-github-username]/params_validator/fork )
89
+ 1. Fork it ( https://github.com/[my-github-username]/params_for/fork )
90
90
  2. Create your feature branch (`git checkout -b my-new-feature`)
91
91
  3. Commit your changes (`git commit -am 'Add some feature'`)
92
92
  4. Push to the branch (`git push origin my-new-feature`)
@@ -1,6 +1,6 @@
1
1
  # app/validators/param_validator/base.rb
2
2
 
3
- module ParamsValidator
3
+ module ParamsFor
4
4
  class Base
5
5
  include ActiveModel::Validations
6
6
 
@@ -1,8 +1,8 @@
1
1
  require 'active_support/concern'
2
2
 
3
- module ParamsValidator
3
+ module ParamsFor
4
4
  module Connectors
5
- module ParamsFor
5
+ module Glue
6
6
  extend ActiveSupport::Concern
7
7
 
8
8
  module ClassMethods
@@ -38,7 +38,7 @@ module ParamsValidator
38
38
  if options[:class]
39
39
  validator_klass = options[:class]
40
40
  else
41
- validator_name = "ParamsValidator::#{name.to_s.classify}"
41
+ validator_name = "ParamsFor::#{name.to_s.classify}"
42
42
  validator_klass = validator_name.constantize
43
43
  end
44
44
 
@@ -0,0 +1,3 @@
1
+ module ParamsFor
2
+ VERSION = "0.0.2"
3
+ end
data/lib/params_for.rb ADDED
@@ -0,0 +1,12 @@
1
+ require 'active_support/hash_with_indifferent_access'
2
+ require 'active_model'
3
+ require 'params_for/version'
4
+
5
+ module ParamsFor
6
+
7
+ autoload :Base, 'params_for/base'
8
+
9
+ module Connectors
10
+ autoload :Glue, 'params_for/connectors/glue'
11
+ end
12
+ end
data/params_for.gemspec CHANGED
@@ -1,11 +1,11 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'params_validator/version'
4
+ require 'params_for/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "params_for"
8
- spec.version = ParamsValidator::VERSION
8
+ spec.version = ParamsFor::VERSION
9
9
  spec.authors = ["andresbravog"]
10
10
  spec.email = ["andresbravog@gmail.com"]
11
11
  spec.summary = %q{Params Validatior for controllers using active_model validations.}
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe ParamsValidator::Base do
3
+ describe ParamsFor::Base do
4
4
 
5
5
  let(:validator_klass) do
6
6
  unless defined?(DummyValidator)
7
- class DummyValidator < ParamsValidator::Base
7
+ class DummyValidator < ParamsFor::Base
8
8
  attr_accessor :id, :name, :type
9
9
 
10
10
  validates :type, inclusion: { in: %w{task project}, allow_nil: true }
@@ -43,7 +43,7 @@ describe ParamsValidator::Base do
43
43
  describe 'attributes_hash' do
44
44
  let(:validator_klass_with_modified_accessor) do
45
45
  unless defined?(NewDummyValidator)
46
- class NewDummyValidator < ParamsValidator::Base
46
+ class NewDummyValidator < ParamsFor::Base
47
47
  attr_accessor :id, :name
48
48
 
49
49
  def id
@@ -1,5 +1,5 @@
1
1
  require 'action_controller'
2
- require 'params_validator'
2
+ require 'params_for'
3
3
  require 'ostruct'
4
4
 
5
5
  module Rails
@@ -47,7 +47,7 @@ Rails.application.routes.draw do
47
47
  resources :dummy, only: [:index]
48
48
  end
49
49
 
50
- class ParamsValidator::Dummy < ParamsValidator::Base
50
+ class ParamsFor::Dummy < ParamsFor::Base
51
51
  attr_accessor :id, :name
52
52
 
53
53
  validates :id, presence: true
@@ -56,7 +56,7 @@ end
56
56
 
57
57
  class DummyController < ActionController::Base
58
58
  include Rails.application.routes.url_helpers
59
- include ParamsValidator::Connectors::ParamsFor
59
+ include ParamsFor::Connectors::Glue
60
60
 
61
61
  params_for :dummy
62
62
 
data/spec/spec_helper.rb CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  $LOAD_PATH.unshift(File.dirname(__FILE__))
5
5
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
- require 'params_validator'
6
+ require 'params_for'
7
7
  require 'rspec'
8
8
  require 'pry'
9
9
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: params_for
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - andresbravog
@@ -136,13 +136,13 @@ files:
136
136
  - LICENSE.txt
137
137
  - README.md
138
138
  - Rakefile
139
- - lib/params_validator.rb
140
- - lib/params_validator/base.rb
141
- - lib/params_validator/connectors/params_for.rb
142
- - lib/params_validator/version.rb
139
+ - lib/params_for.rb
140
+ - lib/params_for/base.rb
141
+ - lib/params_for/connectors/glue.rb
142
+ - lib/params_for/version.rb
143
143
  - params_for.gemspec
144
- - spec/params_validator/base_spec.rb
145
- - spec/params_validator/connectors/params_for_spec.rb
144
+ - spec/params_for/base_spec.rb
145
+ - spec/params_for/connectors/glue_spec.rb
146
146
  - spec/shared/support/dummy_controller.rb
147
147
  - spec/spec_helper.rb
148
148
  homepage: https://github.com/andresbravog/params_for
@@ -170,7 +170,7 @@ signing_key:
170
170
  specification_version: 4
171
171
  summary: Params Validatior for controllers using active_model validations.
172
172
  test_files:
173
- - spec/params_validator/base_spec.rb
174
- - spec/params_validator/connectors/params_for_spec.rb
173
+ - spec/params_for/base_spec.rb
174
+ - spec/params_for/connectors/glue_spec.rb
175
175
  - spec/shared/support/dummy_controller.rb
176
176
  - spec/spec_helper.rb
@@ -1,3 +0,0 @@
1
- module ParamsValidator
2
- VERSION = "0.0.1"
3
- end
@@ -1,12 +0,0 @@
1
- require 'active_support/hash_with_indifferent_access'
2
- require 'active_model'
3
- require 'params_validator/version'
4
-
5
- module ParamsValidator
6
-
7
- autoload :Base, 'params_validator/base'
8
-
9
- module Connectors
10
- autoload :ParamsFor, 'params_validator/connectors/params_for'
11
- end
12
- end