Sha256: 85f2e26dacbec6cd5c4a9c1867f74c28674ffdf71036216a07cec1dc6e3b2e36

Contents?: true

Size: 295 Bytes

Versions: 1

Compression:

Stored size: 295 Bytes

Contents

module Renum
  class NameSerializer
    def initialize enum_class
      @enum_class = enum_class
    end

    def dump v
      v && if v.is_a?(String)
             v
           else
             v.name
           end
    end

    def load s
      s && @enum_class.with_name(s)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
renum-1.4.0 lib/renum/name_serializer.rb