I very much like the way they (the binder) wrapped the library class within a Ruby mixin module.
It is actually meant to be mixed into the programmer’s namespaces:
module AuthorToplevelNamespace
module ThisPlugin
require 'clipper' # assumes gem was pre-installed
include Clipper # includes the Clipper mixin module
# Now the local constant Clipper is a proxy lookup
# to the ::Clipper::Clipper class.(Because identifiers
# are constants and get mixed in during the include.)
def self::union_method(
a = [[0, 0], [0, 100], [100, 100], [100, 0]] ,
b = [[-5, 50], [200, 50], [100, 5]]
)
c = Clipper::new()
c.add_subject_polygon(a)
c.add_clip_polygon(b)
c.union( :non_zero, :non_zero )
end
end
end