class MyPath::Handler
Attributes
list[RW]
path[RW]
Public Class Methods
clean_path(path)
click to toggle source
# File lib/mypath/handler.rb, line 11 def clean_path(path) path.gsub(/:.*/, "") end
for(path)
click to toggle source
# File lib/mypath/handler.rb, line 15 def for(path) handler = self.list.detect{|h| h.can_handle?(path)} if handler handler.new(path) end end
inherited(klass)
click to toggle source
# File lib/mypath/handler.rb, line 7 def inherited(klass) self.list |= [klass] end
new(path)
click to toggle source
# File lib/mypath/handler.rb, line 26 def initialize(path) self.path = self.class.clean_path(path) end