提交 da2cf937 编写于 作者: A Aaron Patterson

no more is_a checks on instantiation

上级 bb207ea7
......@@ -11,15 +11,10 @@ def self.from_string string
end
def initialize(strexp)
case strexp
when Router::Strexp
@spec = strexp.ast
@requirements = strexp.requirements
@separators = strexp.separators.join
@anchored = strexp.anchor
else
raise ArgumentError, "Bad expression: #{strexp}"
end
@spec = strexp.ast
@requirements = strexp.requirements
@separators = strexp.separators.join
@anchored = strexp.anchor
@names = nil
@optional_names = nil
......
......@@ -75,10 +75,6 @@ class TestPattern < ActiveSupport::TestCase
end
end
def test_to_raise_exception_with_bad_expression
assert_raise(ArgumentError, "Bad expression: []") { Pattern.new [] }
end
def test_to_regexp_with_extended_group
strexp = Router::Strexp.build(
'/page/:name',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册