# frozen_string_literal: true module LIT module Object def self.included(object) object.define_singleton_method(:Some) { |value| Option::Some.new(value) } Utils.const_reset(object, "None", Option::None) Utils.const_reset(object, "Some", Class.new(Option::Some)) end # @api public # @since 0.1.0 module Option def self.included(object) object.define_singleton_method(:Some) { |value| Some.new(value) } Utils.const_reset(object, "Some", Class.new(Some)) end None = Class.new class Some attr_reader :value def initialize(value) check_type!(value) @value = value end def __value__ @value end private def check_type!(value); end end end end end