Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Let say that this is a scenario
- ##
- @@algorithm_path = "myRoutingAlgorithm.rb"
- Class Node
- attr_reader :message
- @message
- def add(msg)
- @message=msg
- end
- end
- Class Router
- def self.route_to(from, destination)
- #find the next node at the path in the way to node 'destination'
- #if i'm alredy at node 'from'
- # ...
- return #something
- end
- end
- start = Node.new
- a = Node.new
- b = Node.new
- c = Node.new
- end = Node.new
- #forward the message from start to the first
- #hop in the way to the end
- Router.route_to(start, end).add(start.message)
- ##
- Here is the question.
- The user must give the path to a file where is the
- routing algorithm. How do I include that file and
- use the Router class as an interface?
- This is becouse i'm coding a network routing simulator
Add Comment
Please, Sign In to add comment