modulePlatformendclassPlatform::OSdefself.calculate_current# STUB this would use real data to figure out which class to useOpenBSDenddefself.resolve
missing = []
klass = calculate_current()
inst = klass.new
klass.ancestors.each do |anc|
breakif anc == Platform::OS
anc.verify! inst, missing
endunless missing.empty?
puts "Some platform functions were not found:"
missing.each do |meth|
puts " #{meth}"endunlessENV['PLATFORM_SOFT']
exit 1endendenddefself.attach(name, *args)@methods ||= []
@methods << name
begin
attach_function name, *args
rescueendenddefself.verify!(obj, missing)if@methods@methods.each do |meth|
unless obj.respond_to?(meth)
missing << meth
endendendendendclassPOSIX < Platform::OSendclassModernUnix < POSIX
attach :lchmod, [:string, :mode_t], :int
attach :blah, [], :intendclassBSD < ModernUnixendclassOpenBSD < BSDdeflchmodraiseNotImplementedError, "OpenBSD does not have lchmod"endendPlatform::OS.resolve