I have a ruby class, Feedbin, that was previously the name of a module. When I try and call any methods in the class, a TypeError is thrown: `': Feedbin is not a class (TypeError)
When I change the name of the class, but appending an s for example, things seem to work as expected.
The same program used to have a module named Feedbin as well, but the module no longer exists.
Old:
module Feedbin
class Api
end
end
New:
class Feedbin
end
How can I get rid of the "Feedbin is not a class" type error? What is causing this?
A non-class module cannot be changed into a class. Once you define a (non-class) module, it cannot be changed into a class. You perhaps have:
class Feedbin
...
somewhere prior to where you have
module Feedbin
...
Change that class
into module
, or use a different name instead of Feedbin
for one of those.
Or, does the error message occur for certain methods? Certain methods can be defined on classes only. For example, if you call Feedbin.new
, or something that calls initialize
on Feedbin
, and change Feedbin
into a non-class module, then that would cause an error. In such case, use a different name for the non-class module.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With