hopsoft/field_mapper

View on GitHub
lib/field_mapper/types/plat.rb

Summary

Maintainability
A
0 mins
Test Coverage
require_relative "../standard/plat"

module FieldMapper
  module Types

    class Plat
      extend Forwardable

      attr_reader :type

      class << self

        def [](type)
          Plat.new(type)
        end

      end

      def initialize(type, values=[])
        if type.class != Class || !type.ancestors.include?(FieldMapper::Standard::Plat)
          raise InvalidPlatType.new("#{type} is not a valid plat type")
        end

        @type = type
      end

      def name
        self.class.name
      end

    end

  end
end