Class: Perpetuity::Validations::Presence

Inherits:
Object
  • Object
show all
Defined in:
lib/perpetuity/validations/presence.rb

Instance Method Summary collapse

Constructor Details

#initialize(attribute) ⇒ Presence

Returns a new instance of Presence.



4
5
6
# File 'lib/perpetuity/validations/presence.rb', line 4

def initialize attribute
  @attribute = attribute
end

Instance Method Details

#pass?(object) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
# File 'lib/perpetuity/validations/presence.rb', line 8

def pass? object
  !object.send(@attribute).nil? &&
  object.send(@attribute).strip != ''
end