Class: HumanID::Transliteration::Behaviour
- Inherits:
-
Object
- Object
- HumanID::Transliteration::Behaviour
- Includes:
- Singleton
- Defined in:
- lib/humanid/transliteration.rb
Instance Attribute Summary collapse
-
#downcase ⇒ Object
Returns the value of attribute downcase.
-
#normalize ⇒ Object
Returns the value of attribute normalize.
-
#separator ⇒ Object
Returns the value of attribute separator.
-
#validation_regex ⇒ Object
Returns the value of attribute validation_regex.
Instance Method Summary collapse
-
#initialize ⇒ Behaviour
constructor
A new instance of Behaviour.
- #perform_downcase? ⇒ Boolean
- #perform_normalization? ⇒ Boolean
Constructor Details
#initialize ⇒ Behaviour
Returns a new instance of Behaviour.
71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/humanid/transliteration.rb', line 71 def initialize self.separator = '-' self.downcase = true self.normalize = true # Not starts with hyphen # Contains 1 to 255 word characters and hyphens # Not ends with hyphen # TODO Validation with custom separator self.validation_regex = /(?!-)\A[\w-]{1,255}(?<!-)\z/ end |
Instance Attribute Details
#downcase ⇒ Object
Returns the value of attribute downcase.
69 70 71 |
# File 'lib/humanid/transliteration.rb', line 69 def downcase @downcase end |
#normalize ⇒ Object
Returns the value of attribute normalize.
69 70 71 |
# File 'lib/humanid/transliteration.rb', line 69 def normalize @normalize end |
#separator ⇒ Object
Returns the value of attribute separator.
69 70 71 |
# File 'lib/humanid/transliteration.rb', line 69 def separator @separator end |
#validation_regex ⇒ Object
Returns the value of attribute validation_regex.
69 70 71 |
# File 'lib/humanid/transliteration.rb', line 69 def validation_regex @validation_regex end |
Instance Method Details
#perform_downcase? ⇒ Boolean
83 84 85 |
# File 'lib/humanid/transliteration.rb', line 83 def perform_downcase? downcase end |
#perform_normalization? ⇒ Boolean
87 88 89 |
# File 'lib/humanid/transliteration.rb', line 87 def perform_normalization? normalize end |