lib/raap/value/module.rb in raap-0.4.0 vs lib/raap/value/module.rb in raap-0.5.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
module RaaP
module Value
# FIXME: consider self_types
# HINT: intersection?
class Module < BasicObject
@@ -28,15 +30,17 @@
end
end
"#{a_instance.name}[#{args.map(&:to_s).join(', ')}]"
end
end.then do |ts|
- ts << 'Object' if !ts.include?('::BasicObject')
- Type.new(ts.join(' & ')).pick(size:)
+ if !ts.include?('::BasicObject') || ts.any? { |t| t.split('::').last&.start_with?('_') }
+ ts.unshift('Object')
+ end
+ Type.new(ts.uniq.join(' & ')).pick(size:)
end
end
const = ::Object.const_get(@type.name.absolute!.to_s)
- BindCall.extend(@self_type, const)
+ BindCall.extend(self, const)
end
def method_missing(name, *args, **kwargs, &block)
@self_type.__send__(name, *args, **kwargs, &block)
end