{"action":"created","issue":{"url":"https://api.github.com/repos/lotus/router/issues/74","labels_url":"https://api.github.com/repos/lotus/router/issues/74/labels{/name}","comments_url":"https://api.github.com/repos/lotus/router/issues/74/comments","events_url":"https://api.github.com/repos/lotus/router/issues/74/events","html_url":"https://github.com/lotus/router/pull/74","id":117108609,"number":74,"title":"Introduce Lotus::Router.define","user":{"login":"jodosha","id":5089,"avatar_url":"https://avatars.githubusercontent.com/u/5089?v=3","gravatar_id":"","url":"https://api.github.com/users/jodosha","html_url":"https://github.com/jodosha","followers_url":"https://api.github.com/users/jodosha/followers","following_url":"https://api.github.com/users/jodosha/following{/other_user}","gists_url":"https://api.github.com/users/jodosha/gists{/gist_id}","starred_url":"https://api.github.com/users/jodosha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jodosha/subscriptions","organizations_url":"https://api.github.com/users/jodosha/orgs","repos_url":"https://api.github.com/users/jodosha/repos","events_url":"https://api.github.com/users/jodosha/events{/privacy}","received_events_url":"https://api.github.com/users/jodosha/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/lotus/router/labels/feature","name":"feature","color":"bfe5bf"}],"state":"open","locked":false,"assignee":{"login":"jodosha","id":5089,"avatar_url":"https://avatars.githubusercontent.com/u/5089?v=3","gravatar_id":"","url":"https://api.github.com/users/jodosha","html_url":"https://github.com/jodosha","followers_url":"https://api.github.com/users/jodosha/followers","following_url":"https://api.github.com/users/jodosha/following{/other_user}","gists_url":"https://api.github.com/users/jodosha/gists{/gist_id}","starred_url":"https://api.github.com/users/jodosha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jodosha/subscriptions","organizations_url":"https://api.github.com/users/jodosha/orgs","repos_url":"https://api.github.com/users/jodosha/repos","events_url":"https://api.github.com/users/jodosha/events{/privacy}","received_events_url":"https://api.github.com/users/jodosha/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/lotus/router/milestones/8","html_url":"https://github.com/lotus/router/milestones/v0.6.0","labels_url":"https://api.github.com/repos/lotus/router/milestones/8/labels","id":1337772,"number":8,"title":"v0.6.0","description":"","creator":{"login":"jodosha","id":5089,"avatar_url":"https://avatars.githubusercontent.com/u/5089?v=3","gravatar_id":"","url":"https://api.github.com/users/jodosha","html_url":"https://github.com/jodosha","followers_url":"https://api.github.com/users/jodosha/followers","following_url":"https://api.github.com/users/jodosha/following{/other_user}","gists_url":"https://api.github.com/users/jodosha/gists{/gist_id}","starred_url":"https://api.github.com/users/jodosha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jodosha/subscriptions","organizations_url":"https://api.github.com/users/jodosha/orgs","repos_url":"https://api.github.com/users/jodosha/repos","events_url":"https://api.github.com/users/jodosha/events{/privacy}","received_events_url":"https://api.github.com/users/jodosha/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":6,"state":"open","created_at":"2015-10-05T09:33:38Z","updated_at":"2015-11-16T11:55:16Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-11-16T11:55:16Z","updated_at":"2015-11-16T11:58:53Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/lotus/router/pulls/74","html_url":"https://github.com/lotus/router/pull/74","diff_url":"https://github.com/lotus/router/pull/74.diff","patch_url":"https://github.com/lotus/router/pull/74.patch"},"body":"Returns the given block as it is.\r\n\r\nWhen `Lotus::Router` is used as a standalone gem and the routes are defined into a configuration file, some systems could raise an exception.\r\n\r\nImagine the following file into a Ruby on Rails application:\r\n\r\n```ruby\r\n# app/api/config/routes.rb\r\nget '/', to: 'api#index'\r\n```\r\n\r\nBecause Ruby on Rails in production mode use to eager load code and the routes file uses top level method calls, it crashes the application.\r\n\r\nIf we wrap these routes with `Lotus::Router.define`, the block doesn't get yielded but just returned to the caller as it is.\r\n\r\nUsually the receiver of this block is `Lotus::Router#initialize`, which finally evaluates the block.\r\n\r\n/cc @lotus/core-team @weppos "},"comment":{"url":"https://api.github.com/repos/lotus/router/issues/comments/157008329","html_url":"https://github.com/lotus/router/pull/74#issuecomment-157008329","issue_url":"https://api.github.com/repos/lotus/router/issues/74","id":157008329,"user":{"login":"jodosha","id":5089,"avatar_url":"https://avatars.githubusercontent.com/u/5089?v=3","gravatar_id":"","url":"https://api.github.com/users/jodosha","html_url":"https://github.com/jodosha","followers_url":"https://api.github.com/users/jodosha/followers","following_url":"https://api.github.com/users/jodosha/following{/other_user}","gists_url":"https://api.github.com/users/jodosha/gists{/gist_id}","starred_url":"https://api.github.com/users/jodosha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jodosha/subscriptions","organizations_url":"https://api.github.com/users/jodosha/orgs","repos_url":"https://api.github.com/users/jodosha/repos","events_url":"https://api.github.com/users/jodosha/events{/privacy}","received_events_url":"https://api.github.com/users/jodosha/received_events","type":"User","site_admin":false},"created_at":"2015-11-16T11:58:53Z","updated_at":"2015-11-16T11:58:53Z","body":"I also manually tested it into a Rails app in production mode and it works great! /cc @weppos "}}