{"id":20032569,"url":"https://github.com/akicho8/normalizer","last_synced_at":"2025-10-11T21:09:13.533Z","repository":{"id":27383441,"uuid":"30859423","full_name":"akicho8/normalizer","owner":"akicho8","description":"ActiveRecordのカラム値をいろんな方法で正規化するライブラリ","archived":false,"fork":false,"pushed_at":"2015-03-21T08:28:22.000Z","size":172,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-11T21:09:13.199Z","etag":null,"topics":["activerecord","normalizer","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/akicho8.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-16T08:18:48.000Z","updated_at":"2023-09-15T22:07:58.000Z","dependencies_parsed_at":"2022-08-20T07:30:31.230Z","dependency_job_id":null,"html_url":"https://github.com/akicho8/normalizer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/akicho8/normalizer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akicho8%2Fnormalizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akicho8%2Fnormalizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akicho8%2Fnormalizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akicho8%2Fnormalizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akicho8","download_url":"https://codeload.github.com/akicho8/normalizer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akicho8%2Fnormalizer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279008727,"owners_count":26084494,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["activerecord","normalizer","ruby"],"created_at":"2024-11-13T09:38:18.140Z","updated_at":"2025-10-11T21:09:13.517Z","avatar_url":"https://github.com/akicho8.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"#+OPTIONS: toc:nil num:nil author:nil creator:nil \\n:nil |:t\n#+OPTIONS: @:t ::t ^:t -:t f:t *:t \u003c:t\n\n* ActiveRecordのカラム値を簡単に正規化する仕組み\n\n#+BEGIN_SRC ruby\nclass Book \u003c ActiveRecord::Base\n  with_options(:hankaku =\u003e true, :strip =\u003e true) do |o|\n    o.normalize :title, :strip_tags =\u003e true\n    o.normalize :body, :enter =\u003e true\n  end\nend\n\narticle = Book.create!(:title =\u003e \"\u003cb\u003eＲａｉｌｓの本\u003c/b\u003e　\")\narticle.title # =\u003e \"Railsの本\"\n#+END_SRC\n\n** 機能一覧\n\n   #+ATTR_HTML: border=\"1\" rules=\"all\" frame=\"all\"\n   | シンボル       | 意味                    |\n   |----------------+-------------------------|\n   | hankaku        | 英数字を半角化          |\n   | hiragana       | カタカナをひらがな化    |\n   | strip_tags     | タグを外す              |\n   | scrub          | 不正なバイト列を除去    |\n   | space_zentohan | 全角スペースを半角化    |\n   | enter          | \\r\\n を \\n に統一       |\n   | strip          | 前後の半角スペース除去  |\n   | squish         | activesupport の squish |\n   | truncate       | 指定文字数で切る        |\n   | blank_to_nil   | blank? なら nil にする  |\n   | to_s           | 最後に to_s する        |\n\n** 単体の機能としても使える\n\n#+BEGIN_SRC ruby\nNormalizer.normalize(\"ｒｕｂｙ　ｏｎ　ｒａｉｌｓ\", :hankaku =\u003e true) # =\u003e \"ruby on rails\"\nNormalizer.normalize(\"ドラえもん\", :katakana =\u003e true)                # =\u003e \"ドラエモン\"\nNormalizer.normalize(\"ドラえもん\", :hiragana =\u003e true)                # =\u003e \"どらえもん\"\nNormalizer.normalize(\"\u003cb\u003eドラえもん\u003c/b\u003e\", :strip_tags =\u003e true)       # =\u003e \"ドラえもん\"\nNormalizer.normalize(\"ドラ\\xffえもん\", :scrub =\u003e true)               # =\u003e \"ドラえもん\"\nNormalizer.normalize(\"ruby　on　rails\", :space_zentohan =\u003e true)     # =\u003e \"ruby on rails\"\nNormalizer.normalize(\"foo\\r\\nbar\\r\\n\", :enter =\u003e true)               # =\u003e \"foo\\nbar\\n\"\nNormalizer.normalize(\" ドラえもん \", :strip =\u003e true)                 # =\u003e \"ドラえもん\"\nNormalizer.normalize(\"  ruby  on  rails  \", :squish =\u003e true)         # =\u003e \"ruby on rails\"\nNormalizer.normalize(\"ドラえもん\", :truncate =\u003e 2)                   # =\u003e \"ドラ\"\nNormalizer.normalize(\" \", :blank_to_nil =\u003e true)                     # =\u003e nil\nNormalizer.normalize(nil, :to_s =\u003e true)                             # =\u003e \"\"\n#+END_SRC\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakicho8%2Fnormalizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakicho8%2Fnormalizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakicho8%2Fnormalizer/lists"}