{"action":"opened","issue":{"url":"https://api.github.com/repos/nesquena/rabl/issues/635","labels_url":"https://api.github.com/repos/nesquena/rabl/issues/635/labels{/name}","comments_url":"https://api.github.com/repos/nesquena/rabl/issues/635/comments","events_url":"https://api.github.com/repos/nesquena/rabl/issues/635/events","html_url":"https://github.com/nesquena/rabl/issues/635","id":88964138,"number":635,"title":"How can I share data between 2 rabl files?","user":{"login":"yangzhichina","id":1477388,"avatar_url":"https://avatars.githubusercontent.com/u/1477388?v=3","gravatar_id":"","url":"https://api.github.com/users/yangzhichina","html_url":"https://github.com/yangzhichina","followers_url":"https://api.github.com/users/yangzhichina/followers","following_url":"https://api.github.com/users/yangzhichina/following{/other_user}","gists_url":"https://api.github.com/users/yangzhichina/gists{/gist_id}","starred_url":"https://api.github.com/users/yangzhichina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yangzhichina/subscriptions","organizations_url":"https://api.github.com/users/yangzhichina/orgs","repos_url":"https://api.github.com/users/yangzhichina/repos","events_url":"https://api.github.com/users/yangzhichina/events{/privacy}","received_events_url":"https://api.github.com/users/yangzhichina/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-17T09:14:39Z","updated_at":"2015-06-17T09:14:39Z","closed_at":null,"body":"For meeting requirements of project, I have to replace all keys of JSON and encrypt all values. For example, the origin plain text `{\"name\": \"John\", age: \"30\"}` will be translated into `{\"zzzz\": \"xxxxx=\\n\"}`. When starting to render a rabl, I created a encryption object responsible for key replacement and value encryption.\r\n```ruby\r\n#users.rabl\r\nenc = Encryption.new\r\ncollection @users, :root => enc.map(\"users\"), :object_root => false # Method map is for key replacement.\r\nextends \"users/show\"\r\n```\r\nIn the `show.rabl`, I wanted to reuse the `enc`, but didn't know how to share it between 2 rabl files.\r\n```ruby\r\n# users/show.rabl\r\nnode(enc.map(\"name\")) {|user| enc.encrypt(user.name.to_s)} # Method encrypt is for value encryption.\r\n```\r\n\r\nCould you help me?"}}