Module: Trusty::Omniauth::MappingHelpers

Included in:
ModelMapper, ProviderMapper
Defined in:
lib/trusty/omniauth/mapping_helpers.rb

Instance Method Summary collapse

Instance Method Details

#clean(value, *filters, &default_value) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/trusty/omniauth/mapping_helpers.rb', line 4

def clean(value, *filters, &default_value)
  default_value ||= ->{ nil }

  filters.each do |method_name|
    value = value.to_s.send(method_name)
  end

  value.blank? ? default_value.call : value
end