Skip to content

Instantly share code, notes, and snippets.

@siddhant3030
Created June 19, 2019 06:35
Show Gist options
  • Save siddhant3030/b945d775cd68f8bf2678d9f59de98b90 to your computer and use it in GitHub Desktop.
Save siddhant3030/b945d775cd68f8bf2678d9f59de98b90 to your computer and use it in GitHub Desktop.
siddhants-MacBook-Air:railsblog sid$ rails c
Loading development environment (Rails 5.2.3)
irb(main):001:0> parser = ActionDispatch::Journey::Parser.new
=> #<ActionDispatch::Journey::Parser:0x00007fa630dce528 @scanner=#<ActionDispatch::Journey::Scanner:0x00007fa630dce4b0 @ss=nil>>
irb(main):002:0> syntax_tree = parser.parse("/moderators/:id(.:format)")
=> #<ActionDispatch::Journey::Nodes::Cat:0x00007fa633df05d0 @left=#<ActionDispatch::Journey::Nodes::Slash:0x00007fa633df1110 @left="/", @memo=nil>, @memo=nil, @right=#<ActionDispatch::Journey::Nodes::Cat:0x00007fa633df0648 @left=#<ActionDispatch::Journey::Nodes::Literal:0x00007fa633df0ff8 @left="moderators", @memo=nil>, @memo=nil, @right=#<ActionDispatch::Journey::Nodes::Cat:0x00007fa633df0698 @left=#<ActionDispatch::Journey::Nodes::Slash:0x00007fa633df0f08 @left="/", @memo=nil>, @memo=nil, @right=#<ActionDispatch::Journey::Nodes::Cat:0x00007fa633df06e8 @left=#<ActionDispatch::Journey::Nodes::Symbol:0x00007fa633df0cb0 @left=":id", @memo=nil, @regexp=/[^\.\/\?]+/, @name="id">, @memo=nil, @right=#<ActionDispatch::Journey::Nodes::Group:0x00007fa633df0788 @left=#<ActionDispatch::Journey::Nodes::Cat:0x00007fa633df07d8 @left=#<ActionDispatch::Journey::Nodes::Dot:0x00007fa633df0990 @left=".", @memo=nil>, @memo=nil, @right=#<ActionDispatch::Journey::Nodes::Symbol:0x00007fa633df08a0 @left=":format", @memo=nil, @regexp=/[^\.\/\?]+/, @name="format">>, @memo=nil>>>>>
irb(main):003:0>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment