As per your given requirement I have a solution that would help you.
You can define this way
class Elevator
attr_accessor :current_floor, :min_floor, :max_floor
def initialize(current_floor, min_floor, max_floor)
@current_floor = current_floor
@min_floor = min_floor
@max_floor = max_floor
end
end
Now you can assign the values to the all three attr_accessor
elevator = Elevator.new(100,150,500)
and now check get the values of the attr_accessor and also you check the condition whatever you want
if elevator.current_floor > elevator.max_floor
// perform operation here
else
// perform operation here
end
If you still have any query please let me know.