class EmailSpec::AddressConverter
Attributes
converter[RW]
Public Instance Methods
conversion(&block)
click to toggle source
The block provided to conversion should convert to an email address string or return the input untouched. For example:
EmailSpec::AddressConverter.instance.conversion do |input| if input.is_a?(User) input.email else input end end
# File lib/email_spec/address_converter.rb, line 20 def conversion(&block) self.converter = block end
convert(input)
click to toggle source
# File lib/email_spec/address_converter.rb, line 24 def convert(input) return input unless converter converter.call(input) end