Class: KDomain::DomainModel::Validates
- Inherits:
-
Object
- Object
- KDomain::DomainModel::Validates
- Defined in:
- lib/k_domain/schemas/domain/old/validates.rb
Constant Summary collapse
- KEYS =
%i[length unless format presence].freeze
Instance Attribute Summary collapse
-
#format ⇒ Object
Returns the value of attribute format.
-
#length ⇒ Object
Returns the value of attribute length.
-
#name ⇒ Object
Returns the value of attribute name.
-
#presence ⇒ Object
Returns the value of attribute presence.
-
#unless ⇒ Object
Returns the value of attribute unless.
Instance Method Summary collapse
- #for_template(value) ⇒ Object
- #format_format ⇒ Object
- #format_length ⇒ Object
- #format_presence ⇒ Object
- #format_unless ⇒ Object
- #to_h ⇒ Object
Instance Attribute Details
#format ⇒ Object
Returns the value of attribute format.
12 13 14 |
# File 'lib/k_domain/schemas/domain/old/validates.rb', line 12 def format @format end |
#length ⇒ Object
Returns the value of attribute length.
10 11 12 |
# File 'lib/k_domain/schemas/domain/old/validates.rb', line 10 def length @length end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/k_domain/schemas/domain/old/validates.rb', line 8 def name @name end |
#presence ⇒ Object
Returns the value of attribute presence.
13 14 15 |
# File 'lib/k_domain/schemas/domain/old/validates.rb', line 13 def presence @presence end |
#unless ⇒ Object
Returns the value of attribute unless.
11 12 13 |
# File 'lib/k_domain/schemas/domain/old/validates.rb', line 11 def unless @unless end |
Instance Method Details
#for_template(value) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/k_domain/schemas/domain/old/validates.rb', line 31 def for_template(value) return nil if value.nil? return value.to_s if value.is_a?(Hash) return ":#{value}" if value.is_a?(Symbol) value end |
#format_format ⇒ Object
23 24 25 |
# File 'lib/k_domain/schemas/domain/old/validates.rb', line 23 def format_format for_template(self.format) end |
#format_length ⇒ Object
15 16 17 |
# File 'lib/k_domain/schemas/domain/old/validates.rb', line 15 def format_length for_template(length) end |
#format_presence ⇒ Object
27 28 29 |
# File 'lib/k_domain/schemas/domain/old/validates.rb', line 27 def format_presence for_template(presence) end |
#format_unless ⇒ Object
19 20 21 |
# File 'lib/k_domain/schemas/domain/old/validates.rb', line 19 def format_unless for_template(self.unless) end |
#to_h ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/k_domain/schemas/domain/old/validates.rb', line 39 def to_h { name: name, length: length, unless: self.unless, format: self.format, presence: presence } end |