Class: SampleModels::Model::Validation

Inherits:
Object
  • Object
show all
Defined in:
lib/sample_models/model.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#configObject (readonly)

Returns the value of attribute config.



86
87
88
# File 'lib/sample_models/model.rb', line 86

def config
  @config
end

#typeObject (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

Returns:

  • (Boolean)


92
93
94
# File 'lib/sample_models/model.rb', line 92

def email_format?
  @type == :validates_email_format_of
end

#inclusion?Boolean

Returns:

  • (Boolean)


96
97
98
# File 'lib/sample_models/model.rb', line 96

def inclusion?
  @type == :validates_inclusion_of
end

#presence?Boolean

Returns:

  • (Boolean)


100
101
102
# File 'lib/sample_models/model.rb', line 100

def presence?
  @type == :validates_presence_of
end