normalizer_jp 1.0.0 → 1.1.0

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
  SHA256:
3
- metadata.gz: 417d64efbb124b0e5372e05baeeeef03adacb7813ac02ed4a7a457ddcd903e9c
4
- data.tar.gz: 30e5c9a1dd10f7836e5f28da2d9efde85165071ee0ea29eb78f0dd8ed4afef08
3
+ metadata.gz: be959d8f96ea055feb516013a528287d665669e266fbc408bfc2ceb6bee3d5e9
4
+ data.tar.gz: be0bfa4d50b497bbf89a5bfb0853705a3fb8e0efc22f8eee4e0d31096336cc99
5
5
  SHA512:
6
- metadata.gz: c9610ae79fe74310a87159c992f9250a4cdb528a78513b6789ef6eb52ec44aeca34a616fd84d23e573e3d61cb1f84fa190966a255437f1ee6bf00b6392d993f6
7
- data.tar.gz: f6faec9b08413e0ee6c1d678f9a76d0fa3c6b351e792f896a08138097725d5585a35befecb50c8d9d80468fca1e4ed0e08b7d38c491cfb95ed5738891a2b9ef0
6
+ metadata.gz: '099b28c5f642cffe5af5282a3f6a83b5d7f9e830b9e64d52b5fc30020ca74b582143db9d0eb6cb21d1d59455b4ae9f7223105fd8494ec50f224ad97e84713a42'
7
+ data.tar.gz: a43f7d69f7ca6704de228b0b7c703eab780ee1d2aba5f7d4a55bbdb39478082abfee2989722c75ee3cdb4c983435d8c6f469d7aff81d3072d58f7e2a0b32d5cd
data/README.md CHANGED
@@ -17,6 +17,32 @@ Or install it yourself as:
17
17
 
18
18
  $ gem install normalizer_jp
19
19
 
20
+ ## Getting Started
21
+ Start off by generating normalizer:
22
+
23
+ ```
24
+ bin/rails g normalizer Strip
25
+ ```
26
+
27
+ this should give you a file in:
28
+
29
+ ```
30
+ app/normalizers/strip_normalizer.rb
31
+ ```
32
+
33
+ Check out this file for some hints on how you can customize your normlizer. It should look something like this:
34
+
35
+ ```ruby
36
+ class StripNormalizer < NormalizerJp::Normalizers::Base
37
+ class << self
38
+ # Normalizer class's responsibility is implimentaion of call method as class method
39
+ def call(attribute_value)
40
+ # Here's normalizer space
41
+ end
42
+ end
43
+ end
44
+ ```
45
+
20
46
  ## Usage
21
47
 
22
48
  ### ActiveRecord
@@ -35,7 +61,7 @@ user.name_kana = 'イトウアサコ'
35
61
  user.name_kana #=> 'いとうあさこ'
36
62
  ```
37
63
 
38
- you can use custom normalizer. customer normalizer's responsibility is implementation of call method as class method. It's super cool.
64
+ you can use custom normalizers. custom normalizers's responsibility is implementation of call method as class method. It's super cool.
39
65
  ```ruby
40
66
  # app/normalizers/upcase_normalizer.rb
41
67
  class UpcaseNormalizer < NormalizerJp::Normalizers::Base
@@ -0,0 +1,9 @@
1
+ class NormalizerGenerator < Rails::Generators::NamedBase
2
+ source_root File.expand_path('../templates', __FILE__)
3
+
4
+ def create_normalizer_file
5
+ template 'normalizer.rb', File.join('app/normalizers',
6
+ class_path,
7
+ "#{file_name}_normalizer.rb")
8
+ end
9
+ end
@@ -0,0 +1,8 @@
1
+ class <%= class_name %>Normalizer < NormalizerJp::Normalizers::Base
2
+ class << self
3
+ # Normalizer class's responsibility is implimentaion of call method as class method
4
+ def call(attribute_value)
5
+ # Here's normalizer space
6
+ end
7
+ end
8
+ end
@@ -1,3 +1,3 @@
1
1
  module NormalizerJp
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: normalizer_jp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - koukikitamura
@@ -132,6 +132,8 @@ files:
132
132
  - Rakefile
133
133
  - bin/console
134
134
  - bin/setup
135
+ - lib/generators/normalizer_generator.rb
136
+ - lib/generators/templates/normalizer.rb
135
137
  - lib/normalizer_jp.rb
136
138
  - lib/normalizer_jp/normalize_builder.rb
137
139
  - lib/normalizer_jp/normalizers.rb