E
Eduardo Mucelli R. Oliveira
I have a script with those two following classes:
class String
def to_b
["true"].include?(self.downcase)
end
end
class HereIWantUseToB
"string".to_b
end
Ok, that works fine, the to_b method can be "seen" by
HereIWantToUseToB class. But I wanted to those two classes inside
another class, or module, like this:
class Everything
# The two classes described above are here
end
module Everything
# The two classes described above are here
end
Anyway, for both cases I have the message "NoMethodError: undefined
method `to_b’ for string." What is the scope point in here, what is
the best way solve that so ?
class String
def to_b
["true"].include?(self.downcase)
end
end
class HereIWantUseToB
"string".to_b
end
Ok, that works fine, the to_b method can be "seen" by
HereIWantToUseToB class. But I wanted to those two classes inside
another class, or module, like this:
class Everything
# The two classes described above are here
end
module Everything
# The two classes described above are here
end
Anyway, for both cases I have the message "NoMethodError: undefined
method `to_b’ for string." What is the scope point in here, what is
the best way solve that so ?