Class kullanmadan class metotodu nasıl tanımlarım?

Öncelikle herkese iyi forumlar.
HackerRank’da ruby sorularını çözerken anlamadığım bir soru ile karşılaştım.
Soruda bana nesne üzerinde çalışacak bir metot tanımlamamı istiyor ve bende kök sınıf olan Integer sınıfı üzerinde isteğe uygun bir çözüm oluşturuyorum fakat HackerRank bana ‘burada sınıf tanımlaması var’ tarzında hata çıkarıyor.

Soru:

A method may take zero or more parameters as input. To demonstrate this, we look at the asserts we use on HackerRank. Sometimes, we have to check whether a given number a is within the range b and c (where b

c, and both inclusive ).

Three variables a, b, and c are already defined. Your task is to write code that checks whether a is within the range of b and c by calling the method range? (which we have defined for you as a method for this example) on a and passing b and c as arguments.

Hint

a.range?(b, c)

or

return a.range?(b, c)

or

a.range? b, c

or

return a.range? b, c

Çözümüm:

class Integer
    def range?(b,c)
        return (b..c) === self 
    end
end

Çıkardığı sorun:

Compilation error :(

Check the compiler output, fix the error and try again.

Compile Message

Solution.rb:8: class definition in method body
class Integer
^~~~~~~~~~~~~

Exit Status

1