Here you can try to reproduce your problem:
Does not work:
class Foo< BasicObject
def self.file_size
File.size(__FILE__)
end
end
p Foo.file_size
The reason is the class Filethat is accessible at the top level (i.e. in the class area Object) and inside any class that is a direct / indirect subclass Object. But Fooit has nothing to do with it Object; you wonβt be able to access it inside Foounless you tell it where the Fileclass (or constant) is actually available from.
Job:
class Foo< BasicObject
def self.file_size
::File.size(__FILE__)
end
end
p Foo.file_size
Foo Object, ( :: ) Ruby, File ( class (s) Ruby) Foo. , Ruby.
, .