$ ruby --version
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu]
$ ruby mygame/app/main.rb
Super Bad:4 5 6
Super Good:4 5 6
# this was on 2.11
$ ./dragonruby
** INFO: =app/main.rb= queued to load via ~require~. (-1, -1)
Super Bad:4 2 3
Super Good:4 5 6
class Parent
def foo(a=1, b: 2, c:3)
"#{a} #{b} #{c}"
end
def foo2(a=1, b: 2, c:3)
"#{a} #{b} #{c}"
end
end
class Child < Parent
def foo(a=1, b: 2, c:3)
super
end
def foo2(a=1, b: 2, c:3)
super(a, b:b, c:c)
end
end
puts "Super Bad:" + Child.new.foo(4, b:5, c:6)
puts "Super Good:" + Child.new.foo2(4, b:5, c:6)
def tick a
end
Easy work around, but took some time to figure out why the font wasn't getting rendered right.
using this source
https://ruby-doc.org/docs/ruby-doc-bundle/Manual/man-1.4/syntax.html#super
https://medium.com/rubycademy/the-super-keyword-a75b67f46f05#:~:text=When%20a%20method%20with%20arguments,method%20to%20the%20parent%20method.&text=Here%20the%20Child%20class%20inherits%20from%20the%20Parent%20class.
I ran into this when building a subclass off of https://github.com/danhealy/dragonruby-zif/blob/16b5b2daebe30b0aaf5684e285f2bdd3879e349b/app/lib/zif/ui/label.rb#L55 and the initialize method had a ton of arguments that I initially didn't pass to super
Easy work around, but took some time to figure out why the font wasn't getting rendered right.