It seems i don't quite understand initializing or using a class within another class.
I have a Sinatra app and have created a class to handle fetching data from an api
# path: ./lib/api/bikes/bike_check
# logic here
# Class that calls BikeCheck api
class BikeCommands < SlackRubyBot::Bot
match /^Is this bike stolen (?<frame_number>\w*)\?$/ do |client, data, match|
client.say(channel: data.channel, text: @message)
No, you can not require a method defined in class - methods defined in class only available to class, class instances and within the inheritance.
Mixing method only possible with including modules.
To solve you issue you could either do
class BikeCommands < SlackRubyBot::Bot match /^Is this bike stolen (?<frame_number>\w*)\?$/ do |client, data, match| BikeCheck.check_frame_number(match[:frame_number]) # <=========== client.say(channel: data.channel, text: @message) end end
or write a module with the method and
extend in class, you want that method to be available in.