diff --git a/core/integer.rbs b/core/integer.rbs index b59acd7..5e96f19 100644 --- a/core/integer.rbs +++ b/core/integer.rbs @@ -64,4 +64,10 @@ class Integer < Object # # alias to_s inspect # alias self.to_s self.inspect + + def times: () { (Integer i) -> void } -> self + + def upto: (Integer max) { (Integer i) -> void } -> self + + def downto: (Integer min) { (Integer i) -> void } -> self end diff --git a/test/integer.rb b/test/integer.rb index c8089fa..23d1471 100644 --- a/test/integer.rb +++ b/test/integer.rb @@ -56,4 +56,10 @@ 123.clamp 0, 100 123.clamp 0, 100.0 +123.times { |i| i } + +123.upto(456) { |i| i } + +456.downto(123) { |i| i } + # rubocop:enable all