]> icculus.org git repositories - duncan/yastx-core.git/blob - lib/scr.rb
(no commit message)
[duncan/yastx-core.git] / lib / scr.rb
1
2 require 'plugin'
3 require 'base'
4
5 module SCR
6
7   class Exception < RuntimeError
8   end
9
10   class NoAgent < SCR::Exception
11   end
12
13   # tries to find an agent for a path
14   def self.find_agent_for_path(path)
15     Plugin.extensions(:agent).each do |plugin|
16       return plugin if plugin.supports_path?(path)
17     end
18     raise NoAgent
19   end
20
21   def self.read(path)
22     agent = find_agent_for_path(path)
23     return agent.read(path)
24   end
25 end
26
27