module FStrings::Formats
@private
Public Class Methods
[]=(klass, formatter)
click to toggle source
# File lib/fstrings/formats.rb, line 11 def []=(klass, formatter) formats[klass] = formatter end
apply(val, format)
click to toggle source
# File lib/fstrings/formats.rb, line 19 def apply(val, format) self.for(val.class).call(val, format) end
for(klass)
click to toggle source
# File lib/fstrings/formats.rb, line 15 def for(klass) formats.select { |k,| klass <= k }.min_by { |k,| klass.ancestors.index(k) }.last end
formats()
click to toggle source
# File lib/fstrings/formats.rb, line 7 def formats @formats ||= {} end