Sha256: bddb52886879001ef64e29cb816375a9b325a815425dbf775787d53482e2b3b4

Contents?: true

Size: 390 Bytes

Versions: 5

Compression:

Stored size: 390 Bytes

Contents

module Monolens
  module Type
    class Symbol
      extend Type::ErrorHandling

      def self.===(instance)
        instance.is_a?(::Symbol)
      end

      def self.dress(instance, registry, &block)
        unless instance.is_a?(::String) or instance.is_a?(::Symbol)
          fail!("Invalid symbol #{instance}", &block)
        end

        instance.to_sym
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
monolens-0.6.4 lib/monolens/type/symbol.rb
monolens-0.6.3 lib/monolens/type/symbol.rb
monolens-0.6.2 lib/monolens/type/symbol.rb
monolens-0.6.1 lib/monolens/type/symbol.rb
monolens-0.6.0 lib/monolens/type/symbol.rb