lib/divining_rod.rb in divining_rod-0.1.1 vs lib/divining_rod.rb in divining_rod-0.2.0
- old
+ new
@@ -1,28 +1,28 @@
require 'yaml'
module DiviningRod
- class UndefinedDefault < StandardError
-
- end
-
class Profile
attr_reader :match
def initialize(request)
matchers.each do |matcher|
@match = matcher if matcher.matches?(request)
break if @match
end
- raise UndefinedDefault, "Please define a default group for DiviningRod" unless @match
+ nil
end
def group
@match.group
end
alias_method :format, :group
+
+ def recognized?
+ !!@match
+ end
def method_missing(meth)
if meth.to_s.match(/(.+)\?$/)
tag = $1
@match.tags.include?(tag.to_s) || @match.tags.include?(tag.to_sym) || @match.tags == tag
\ No newline at end of file