parameter_normalizer 0.1.0 → 0.3.0

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
  SHA256:
3
- metadata.gz: d07ff233a093a1141aaf3030dc21cb66e4aa91148555ba5f26c1f98f140487fe
4
- data.tar.gz: 45432ed88870f637720a5248e3b3eae540593c28456745ddb6813249665d73ea
3
+ metadata.gz: 58d4d06affca59a94ff2f62dc948c1b130869407246fdbb6561534ac349e8e7f
4
+ data.tar.gz: 892359b6a2b76b655217f6e1a7b491fab1993d7a9a1b84b50bc6b66eeda635fb
5
5
  SHA512:
6
- metadata.gz: 594b7fc96c126223af7fc78b03bb05f8b8eb7785c615b2d600e822438b87df4031deabff37038b268b9af027f390768c4cfb51843d2959b21ba0de45cec3d390
7
- data.tar.gz: 42e5d03971318c33d18699bb7d642c6121c6b96ad84579d456740353f67dd170f503d990b46ad7c2dfd13db49f74f09ed05f3c46bc48bbbd7f965ca9866ca6e7
6
+ metadata.gz: 3a54177aa28fd77f9cec3a5aa4ca1f3edeb06afb31ae2a605dadc273c69e51f44849f0be0890aed3fa083e41bbc343266100699537f37067713d5b64d15f6970
7
+ data.tar.gz: afbc832b80a5612d503dcdb04b615832fe9ed984cd33fcadb8248ea02df3cb0556ab4cd796ad285cfbb2c2dc10e350ffd3db3e7d3185aa91b6d170fc5fbde530
@@ -6,6 +6,14 @@ module ParameterNormalizer
6
6
  def parameter_normalizer
7
7
  @parameter_normalizer ||= ParameterNormalizer::Normalizer.new
8
8
  end
9
+
10
+ def normalize_parameter(key, method, skip_key_not_found: true)
11
+ if skip_key_not_found
12
+ return unless params.key?(key)
13
+ end
14
+
15
+ params[key] = parameter_normalizer.public_send(method, params[key])
16
+ end
9
17
  end
10
18
  end
11
19
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ParameterNormalizer
4
- VERSION = "0.1.0"
4
+ VERSION = "0.3.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parameter_normalizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takahiro Ooishi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-11 00:00:00.000000000 Z
11
+ date: 2024-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -59,7 +59,6 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - README.md
63
62
  - lib/parameter_normalizer.rb
64
63
  - lib/parameter_normalizer/controller_concerns/normalizable.rb
65
64
  - lib/parameter_normalizer/normalizer.rb
data/README.md DELETED
@@ -1,33 +0,0 @@
1
- # ParameterNormalizer
2
-
3
- TODO: Delete this and the text below, and describe your gem
4
-
5
- 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/parameter_normalizer`. To experiment with that code, run `bin/console` for an interactive prompt.
6
-
7
- ## Installation
8
-
9
- Install the gem and add to the application's Gemfile by executing:
10
-
11
- $ bundle add parameter_normalizer
12
-
13
- If bundler is not being used to manage dependencies, install the gem by executing:
14
-
15
- $ gem install parameter_normalizer
16
-
17
- ## Usage
18
-
19
- TODO: Write usage instructions here
20
-
21
- ## Development
22
-
23
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
24
-
25
- 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
26
-
27
- ## Contributing
28
-
29
- Bug reports and pull requests are welcome on GitHub at https://github.com/taka0125/parameter_normalizer.
30
-
31
- ## License
32
-
33
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).