Sha256: afad7e7cad02cceadcdb9bff784029517c8c9a9bd9c47049b93b73aee9d1e2ba

Contents?: true

Size: 371 Bytes

Versions: 4

Compression:

Stored size: 371 Bytes

Contents

module Rasti
  module Types
    class Symbol
      class << self

        include Castable

        private

        def valid?(value)
          !value.nil? && (value.respond_to?(:to_sym) || value.respond_to?(:to_s))
        end

        def transform(value)
          value.respond_to?(:to_sym) ? value.to_sym : value.to_s.to_sym
        end

      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rasti-types-1.1.2 lib/rasti/types/symbol.rb
rasti-types-1.1.1 lib/rasti/types/symbol.rb
rasti-types-1.1.0 lib/rasti/types/symbol.rb
rasti-types-1.0.0 lib/rasti/types/symbol.rb