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


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

def apply(value)
  value
end

#apply?(value, convert_to_type) ⇒ Boolean

Returns:


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

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

#typeObject


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

def type
  NilClass
end