rails-dsl 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +2 -0
- data/LICENSE +8 -0
- data/README.md +6 -0
- data/Rakefile +1 -0
- data/VERSION +1 -0
- data/lib/rails-dsl/duck_params.rb +32 -0
- data/lib/rails-dsl.rb +2 -0
- data/rails-dsl.gemspec +25 -0
- metadata +109 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: efbdd3ac7f7d06eec5c30a65c7664db4e5b45492
|
4
|
+
data.tar.gz: 0cf779ed6b84d9f0a1f31d948e8f7de944084851
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a029840c8eb6d3814e487f9ad2611dcadd42257b959cf44d88228bec2443c7692f026322d62315a8803ef6516163c8b090aeb96a28223edddfc9750b3a541cfd
|
7
|
+
data.tar.gz: 699fe83ed9bab1c0e085cfd2eaa319837fdc40548a2b141d94a99f007a7c40fa8a870e6cb08679bcef811f4a07ec2541ee0830cc0ad1779aea348ab08454c784
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
Copyright (c) 2014 Adam Luzsi
|
2
|
+
|
3
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
4
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
5
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
6
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
7
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
8
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require File.join"bundler","gem_tasks"
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'str2duck'
|
2
|
+
|
3
|
+
module RailsDuckParams
|
4
|
+
|
5
|
+
def params_duck
|
6
|
+
|
7
|
+
@duck_params_origin ||= params.dup
|
8
|
+
@duck_params_cache ||= nil
|
9
|
+
|
10
|
+
if params == @duck_params_origin && !@duck_params_cache.nil?
|
11
|
+
|
12
|
+
return @duck_params_cache
|
13
|
+
|
14
|
+
else
|
15
|
+
|
16
|
+
@duck_params_cache= params.dup
|
17
|
+
@duck_params_origin= params.dup
|
18
|
+
|
19
|
+
params.each do |k,v|
|
20
|
+
@duck_params_cache[k]=( ::Str2Duck.parse(v) ) if v.class <= String
|
21
|
+
end
|
22
|
+
|
23
|
+
return @duck_params_cache
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
alias duck_params params_duck
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
ActionController::Base.__send__ :include, RailsDuckParams
|
data/lib/rails-dsl.rb
ADDED
data/rails-dsl.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
|
5
|
+
spec.name = "rails-dsl"
|
6
|
+
spec.version = File.open(File.join(File.dirname(__FILE__),"VERSION")).read.split("\n")[0].chomp.gsub(' ','')
|
7
|
+
spec.authors = ["Adam Luzsi"]
|
8
|
+
spec.email = ["adamluzsi@gmail.com"]
|
9
|
+
|
10
|
+
spec.description = %q{ Provide Rails with some extra helpers, for example for to ApplicationController a 'duck_params' that parse string values into the right_obj like Fixnum or Integer or json to hash }
|
11
|
+
spec.summary = %q{ provide a duck_params/params_duck call in the ApplicationControllers }
|
12
|
+
|
13
|
+
spec.homepage = "https://github.com/adamluzsi/#{__FILE__.split(File::Separator).last.split('.').first}"
|
14
|
+
spec.files = `git ls-files`.split($/)
|
15
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
16
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
|
+
spec.require_paths = ["lib"]
|
18
|
+
|
19
|
+
spec.add_development_dependency "bundler"
|
20
|
+
spec.add_development_dependency "rake"
|
21
|
+
|
22
|
+
spec.add_dependency "str2duck", ">= 1.6.0"
|
23
|
+
spec.add_dependency "rails", ">= 3.0.0"
|
24
|
+
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails-dsl
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Adam Luzsi
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-05-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: str2duck
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.6.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.6.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rails
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.0.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 3.0.0
|
69
|
+
description: " Provide Rails with some extra helpers, for example for to ApplicationController
|
70
|
+
a 'duck_params' that parse string values into the right_obj like Fixnum or Integer
|
71
|
+
or json to hash "
|
72
|
+
email:
|
73
|
+
- adamluzsi@gmail.com
|
74
|
+
executables: []
|
75
|
+
extensions: []
|
76
|
+
extra_rdoc_files: []
|
77
|
+
files:
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- VERSION
|
83
|
+
- lib/rails-dsl.rb
|
84
|
+
- lib/rails-dsl/duck_params.rb
|
85
|
+
- rails-dsl.gemspec
|
86
|
+
homepage: https://github.com/adamluzsi/rails-dsl
|
87
|
+
licenses: []
|
88
|
+
metadata: {}
|
89
|
+
post_install_message:
|
90
|
+
rdoc_options: []
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
requirements: []
|
104
|
+
rubyforge_project:
|
105
|
+
rubygems_version: 2.2.2
|
106
|
+
signing_key:
|
107
|
+
specification_version: 4
|
108
|
+
summary: provide a duck_params/params_duck call in the ApplicationControllers
|
109
|
+
test_files: []
|