Sha256: 3cedc6059c77932eb044763c99ef28a553b739784eca46f82ea8bc55afb6aa38

Contents?: true

Size: 443 Bytes

Versions: 1

Compression:

Stored size: 443 Bytes

Contents

module Repper
  module Format
    def self.cast(arg)
      case arg
      when ::Proc             then arg
      when :x                 then Format::Extended
      when ::Symbol, ::String then Format.const_get(arg.capitalize) rescue nil
      when false, nil         then Format::Inline
      end || raise(Repper::ArgumentError, "unknown format #{arg.inspect}")
    end
  end
end

::Dir["#{__dir__}/format/*.rb"].each { |file| require file }

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
repper-1.1.0 lib/repper/format.rb