Class: SampleModels::Model::Validation
- Inherits:
-
Object
- Object
- SampleModels::Model::Validation
- Defined in:
- lib/sample_models/model.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #email_format? ⇒ Boolean
- #inclusion? ⇒ Boolean
-
#initialize(type, config = {}) ⇒ Validation
constructor
A new instance of Validation.
- #presence? ⇒ Boolean
Constructor Details
#initialize(type, config = {}) ⇒ Validation
Returns a new instance of Validation.
88 89 90 |
# File 'lib/sample_models/model.rb', line 88 def initialize(type, config = {}) @type, @config = type, config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
86 87 88 |
# File 'lib/sample_models/model.rb', line 86 def config @config end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
86 87 88 |
# File 'lib/sample_models/model.rb', line 86 def type @type end |
Instance Method Details
#email_format? ⇒ Boolean
92 93 94 |
# File 'lib/sample_models/model.rb', line 92 def email_format? @type == :validates_email_format_of end |
#inclusion? ⇒ Boolean
96 97 98 |
# File 'lib/sample_models/model.rb', line 96 def inclusion? @type == :validates_inclusion_of end |
#presence? ⇒ Boolean
100 101 102 |
# File 'lib/sample_models/model.rb', line 100 def presence? @type == :validates_presence_of end |