Sha256: 8cc8ea1325f4a843eb5be217a6d6957438293eca7dae44060a80c4e8915e725b

Contents?: true

Size: 516 Bytes

Versions: 2

Compression:

Stored size: 516 Bytes

Contents

module NxtSchema
  module Template
    class TypeSystemResolver
      include NxtInit
      attr_init :node

      delegate_missing_to :node

      def call
        type_system = options.fetch(:type_system) { parent_node&.type_system }

        if type_system.is_a?(Module)
          type_system
        elsif type_system.is_a?(Symbol) || type_system.is_a?(String)
          "NxtSchema::Types::#{type_system.to_s.classify}".constantize
        else
          NxtSchema::Types
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nxt_schema-1.0.2 lib/nxt_schema/template/type_system_resolver.rb
nxt_schema-1.0.1 lib/nxt_schema/template/type_system_resolver.rb