Class: HappyMapper::SupportedTypes::NilOrAlreadyConverted

Inherits:
Object
  • Object
show all
Defined in:
lib/happymapper/supported_types.rb

Overview

For the cases when the value is nil or is already the intended type then no work needs to be done and the value simply can be returned.

Instance Method Summary collapse

Instance Method Details

#apply(value) ⇒ Object



93
94
95
# File 'lib/happymapper/supported_types.rb', line 93

def apply(value)
  value
end

#apply?(value, convert_to_type) ⇒ Boolean

Returns:



89
90
91
# File 'lib/happymapper/supported_types.rb', line 89

def apply?(value,convert_to_type)
  value.kind_of?(convert_to_type) || value.nil?
end

#typeObject



85
86
87
# File 'lib/happymapper/supported_types.rb', line 85

def type
  NilClass
end