Skip to content

Commit 139aaa9

Browse files
committed
Add a Ruby::Box fallback
1 parent d59be9a commit 139aaa9

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

lib/quickdraw.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
# frozen_string_literal: true
22

33
module Quickdraw
4-
Box = Ruby::Box.new
4+
module NoBox
5+
def self.require(...)
6+
Kernel.require(...)
7+
end
8+
9+
def self.const_missing(name)
10+
Kernel.const_get(name).tap { |it| const_set(name, it) }
11+
end
12+
end
13+
14+
Box = (defined?(Ruby::Box) && ENV["RUBY_BOX"]) ? Ruby::Box.new : NoBox
515

616
autoload :CLI, "quickdraw/cli"
717
autoload :Test, "quickdraw/test"

0 commit comments

Comments
 (0)