class LIT::Builder::Option

@api private @since 0.1.0

Public Class Methods

new(mod, type) click to toggle source
# File lib/lit/builder/option.rb, line 8
def initialize(mod, type)
  @type_checker = TypeChecker.new(mod)
  @type = type
end

Public Instance Methods

build() click to toggle source
# File lib/lit/builder/option.rb, line 13
def build
  mod = Module.new do
    include ::LIT::Object::Option
  end

  type_checker = @type_checker
  type = @type

  mod::Some.define_method(:check_type!) do |value|
    # NOTE: actually covered, but SimpleCov cannot detect that
    # :nocov:
    type_checker.check_type!(type, value)
    # :nocov:
  end

  mod
end