Class: Rtasklib::Models::VirtusDuration

Inherits:
Virtus::Attribute
  • Object
show all
Defined in:
lib/rtasklib/models.rb

Overview

Custom coercer that changes a string input into an TWDuration object If nil? or blank? it returns nil

Modifies the #coerce method.

Instance Method Summary (collapse)

Instance Method Details

- (TWDuration?) coerce(v)

Parameters:

  • any (Object)

    value that we are trying to coerce, probably String

Returns:



36
37
38
# File 'lib/rtasklib/models.rb', line 36

def coerce(v)
  if v.nil? || v.blank? then nil else TWDuration.new(v) end
end