{"action":"created","issue":{"url":"https://api.github.com/repos/solnic/transproc/issues/29","labels_url":"https://api.github.com/repos/solnic/transproc/issues/29/labels{/name}","comments_url":"https://api.github.com/repos/solnic/transproc/issues/29/comments","events_url":"https://api.github.com/repos/solnic/transproc/issues/29/events","html_url":"https://github.com/solnic/transproc/issues/29","id":75964308,"number":29,"title":"Add transformations for instantiating objects from input","user":{"login":"solnic","id":1066,"avatar_url":"https://avatars.githubusercontent.com/u/1066?v=3","gravatar_id":"","url":"https://api.github.com/users/solnic","html_url":"https://github.com/solnic","followers_url":"https://api.github.com/users/solnic/followers","following_url":"https://api.github.com/users/solnic/following{/other_user}","gists_url":"https://api.github.com/users/solnic/gists{/gist_id}","starred_url":"https://api.github.com/users/solnic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solnic/subscriptions","organizations_url":"https://api.github.com/users/solnic/orgs","repos_url":"https://api.github.com/users/solnic/repos","events_url":"https://api.github.com/users/solnic/events{/privacy}","received_events_url":"https://api.github.com/users/solnic/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-05-13T12:17:45Z","updated_at":"2015-05-14T09:57:42Z","closed_at":null,"body":"Currently ROM does that by simply doing `t(-> tuple { header.model.new(tuple) })` but I think it'd be good to have a function for that here with a couple of strategies:\r\n\r\n- model.new(input)\r\n- object allocation + set ivars (this should be faster but skips the constructor)\r\n- with splat args for struct-like constructors\r\n\r\nI'm not sure about the naming though, in morpher there's `load_attribute_hash`, `load_attribute_accessors` and `load_instance_variables`. Maybe we should use the same but I dunno."},"comment":{"url":"https://api.github.com/repos/solnic/transproc/issues/comments/101989160","html_url":"https://github.com/solnic/transproc/issues/29#issuecomment-101989160","issue_url":"https://api.github.com/repos/solnic/transproc/issues/29","id":101989160,"user":{"login":"solnic","id":1066,"avatar_url":"https://avatars.githubusercontent.com/u/1066?v=3","gravatar_id":"","url":"https://api.github.com/users/solnic","html_url":"https://github.com/solnic","followers_url":"https://api.github.com/users/solnic/followers","following_url":"https://api.github.com/users/solnic/following{/other_user}","gists_url":"https://api.github.com/users/solnic/gists{/gist_id}","starred_url":"https://api.github.com/users/solnic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solnic/subscriptions","organizations_url":"https://api.github.com/users/solnic/orgs","repos_url":"https://api.github.com/users/solnic/repos","events_url":"https://api.github.com/users/solnic/events{/privacy}","received_events_url":"https://api.github.com/users/solnic/received_events","type":"User","site_admin":false},"created_at":"2015-05-14T09:57:42Z","updated_at":"2015-05-14T09:57:42Z","body":"Good point, let’s start w/o it and just pass in allocated object\n\nOn Thu, May 14, 2015 at 10:44 AM Andy Holland <notifications@github.com>\nwrote:\n\n> Ahh OK cool, does allocate need to be in transproc? Could just do:\n>\n> MyClass = Class.new { attr_reader :attribute }Transproc(:set_ivars, MyClass.allocate)[attribute: 'value']\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/solnic/transproc/issues/29#issuecomment-101973644>.\n>\n"}}