emoji-validator 0.1.1 → 0.1.2

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
  SHA1:
3
- metadata.gz: 35a0c379a37c9d17a0f000cd2449eaa13db16cc1
4
- data.tar.gz: e5ce73d86cf725eb0916674be7664799348edfeb
3
+ metadata.gz: d8c78eaec76edabf318de16e9d31dbb156c7030c
4
+ data.tar.gz: 9e57b00fe7ba0a58b16bc55d0a7e6d5b3725445a
5
5
  SHA512:
6
- metadata.gz: 95c962bc20cf86d1eed523e14612fd1013e1de2cb098c6d6be1b65fe4616efd3979001a8492ed7eb6abe44c460e4b1a1877749ab21ce4b9ca86c9896763d4f65
7
- data.tar.gz: 828394d860c15c1a1e71bd4fdc441331511ae8f96278a35e3863e9e2ef241c7b355ccb05f25d22e4eb36ba0ec261e0435e2a63de0683e554f33f0c4408caf07c
6
+ metadata.gz: c3f1109bf6b4f8de35efe93f4973843e481d306f2567dea535c38767e173cf154780a887b5a842a832e586fb853b8a5b97b8200fa657ab51d230c561ce6d5a50
7
+ data.tar.gz: b1f409270d37f485e1e5c85f495afe257da49c864b5b367886e2b1bd10db9993f5ab3e77c68e8948b07f3a3cb4139c526d721ba640552ef1bc5bd17de929fa40
@@ -5,7 +5,7 @@ require 'emoji/validator/no_emoji_anywhere_validator'
5
5
  require 'emoji/validator/no_emoji_validator'
6
6
 
7
7
  module Emoji
8
- # ActiveModel and ActiveRecord validators to prevent
8
+ # <tt>ActiveModel</tt> and <tt>ActiveRecord</tt> validators to prevent
9
9
  # emojis from being present in your attributes
10
10
  module Validator
11
11
  # Your code goes here...
@@ -1,17 +1,18 @@
1
1
  # rubocop:disable Style/AsciiComments
2
2
  module Emoji
3
3
  module Validator
4
- # Validates all `string` and `text` attributes of ActiveRecord::Base class
4
+ # Validates all <tt>string</tt> and <tt>text</tt> attributes
5
+ # of an <tt>ActiveRecord::Base</tt> class
5
6
  # Include it in your model to automatically apply the validation
6
- # ```ruby
7
- # class Person < ActiveRecord::Base
8
- # include Emoji::Validator::NoEmojiAnywhereValidator
9
- # end
10
7
  #
11
- # person = Person.new(first_name: "😃", last_name: "😃")
12
- # person.valid? #false
13
- # person.errors.count #2
14
- # ```
8
+ # class Person < ActiveRecord::Base
9
+ # include Emoji::Validator::NoEmojiAnywhereValidator
10
+ # end
11
+ #
12
+ # person = Person.new(first_name: "😃", last_name: "😃")
13
+ # person.valid? #false
14
+ # person.errors.count #2
15
+ #
15
16
  module NoEmojiAnywhereValidator
16
17
  def self.included(base)
17
18
  base.class_eval do
@@ -2,16 +2,16 @@
2
2
  module Emoji
3
3
  module Validator
4
4
  # Validate an attribute against emojis
5
- # ```ruby
6
- # class Person < ApplicationRecord
7
- # validates :first_name, no_emoji: true
8
- # end
9
5
  #
10
- # person = Person.new(first_name: "John", last_name: "😃")
11
- # person.valid? #true
12
- # person.first_name = "😃"
13
- # person.valid? #false
14
- # ```
6
+ # class Person < ApplicationRecord
7
+ # validates :first_name, no_emoji: true
8
+ # end
9
+ #
10
+ # person = Person.new(first_name: "John", last_name: "😃")
11
+ # person.valid? #true
12
+ # person.first_name = "😃"
13
+ # person.valid? #false
14
+ #
15
15
  class NoEmojiValidator < ActiveModel::EachValidator
16
16
  def validate_each(record, attribute, value)
17
17
  return if value.match(Unicode::Emoji::REGEX_ANY).nil?
@@ -1,5 +1,5 @@
1
1
  module Emoji
2
2
  module Validator
3
- VERSION = '0.1.1'.freeze
3
+ VERSION = '0.1.2'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emoji-validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernat Rafales