Sha256: 241c509ed0d9b8e3a154300d9f5c1dd7fb48809df71b3f373eb1e278b4f838de

Contents?: true

Size: 526 Bytes

Versions: 2

Compression:

Stored size: 526 Bytes

Contents

# frozen_string_literal: true

module LIT
  module Builder
    # @api private
    # @since 0.1.0
    class Array
      def initialize(mod, type)
        @type_checker = TypeChecker.new(mod)
        @type = type
      end

      def build
        type_checker = @type_checker
        type = @type

        Class.new(::LIT::Object::Array) do
          define_method(:check_type!) do |value|
            type_checker.check_type!(type, value)
          end

          private(:check_type!)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
litl-0.1.1 lib/lit/builder/array.rb
litl-0.1.0 lib/lit/builder/array.rb