Module: LedgerSync::Validatable

Included in:
Resource
Defined in:
lib/ledger_sync/concerns/validatable.rb

Instance Method Summary collapse

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/ledger_sync/concerns/validatable.rb', line 5

def valid?
  validate.success?
end

#validateObject

Raises:

  • (NotImplementedError)


9
10
11
# File 'lib/ledger_sync/concerns/validatable.rb', line 9

def validate
  raise NotImplementedError
end

#validate_or_failObject



13
14
15
16
17
18
19
# File 'lib/ledger_sync/concerns/validatable.rb', line 13

def validate_or_fail
  if valid?
    Resonad.Success(self)
  else
    Resonad.Failure
  end
end