Class: Hanami::Validations::Namespace Private
- Inherits:
-
Object
- Object
- Hanami::Validations::Namespace
- Defined in:
- lib/hanami/validations/namespace.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Validations message namespace.
For a given ‘FooValidator` class, it will look for I18n messages within the `foo` group.
Constant Summary collapse
- SUFFIX =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'Validator'.freeze
- SUFFIX_REPLACEMENT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
''.freeze
- RUBY_NAMESPACE_SEPARATOR =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'/'.freeze
- RUBY_NAMESPACE_REPLACEMENT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'.'.freeze
Class Method Summary collapse
- .new(name, klass) ⇒ Object private
Instance Method Summary collapse
-
#initialize(name) ⇒ Namespace
constructor
private
A new instance of Namespace.
- #to_s ⇒ Object private
Constructor Details
#initialize(name) ⇒ Namespace
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Namespace.
40 41 42 |
# File 'lib/hanami/validations/namespace.rb', line 40 def initialize(name) @name = name end |
Class Method Details
.new(name, klass) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
31 32 33 34 35 36 |
# File 'lib/hanami/validations/namespace.rb', line 31 def self.new(name, klass) result = name || klass.name return nil if result.nil? super(result) end |
Instance Method Details
#to_s ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
46 47 48 |
# File 'lib/hanami/validations/namespace.rb', line 46 def to_s underscored_name.gsub(RUBY_NAMESPACE_SEPARATOR, RUBY_NAMESPACE_REPLACEMENT) end |