{"action":"created","issue":{"url":"https://api.github.com/repos/aasm/aasm/issues/315","labels_url":"https://api.github.com/repos/aasm/aasm/issues/315/labels{/name}","comments_url":"https://api.github.com/repos/aasm/aasm/issues/315/comments","events_url":"https://api.github.com/repos/aasm/aasm/issues/315/events","html_url":"https://github.com/aasm/aasm/pull/315","id":130057365,"number":315,"title":"RubyMotion support.","user":{"login":"Infotaku","id":2786888,"avatar_url":"https://avatars.githubusercontent.com/u/2786888?v=3","gravatar_id":"","url":"https://api.github.com/users/Infotaku","html_url":"https://github.com/Infotaku","followers_url":"https://api.github.com/users/Infotaku/followers","following_url":"https://api.github.com/users/Infotaku/following{/other_user}","gists_url":"https://api.github.com/users/Infotaku/gists{/gist_id}","starred_url":"https://api.github.com/users/Infotaku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Infotaku/subscriptions","organizations_url":"https://api.github.com/users/Infotaku/orgs","repos_url":"https://api.github.com/users/Infotaku/repos","events_url":"https://api.github.com/users/Infotaku/events{/privacy}","received_events_url":"https://api.github.com/users/Infotaku/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"alto","id":3209,"avatar_url":"https://avatars.githubusercontent.com/u/3209?v=3","gravatar_id":"","url":"https://api.github.com/users/alto","html_url":"https://github.com/alto","followers_url":"https://api.github.com/users/alto/followers","following_url":"https://api.github.com/users/alto/following{/other_user}","gists_url":"https://api.github.com/users/alto/gists{/gist_id}","starred_url":"https://api.github.com/users/alto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alto/subscriptions","organizations_url":"https://api.github.com/users/alto/orgs","repos_url":"https://api.github.com/users/alto/repos","events_url":"https://api.github.com/users/alto/events{/privacy}","received_events_url":"https://api.github.com/users/alto/received_events","type":"User","site_admin":false},"milestone":null,"comments":3,"created_at":"2016-01-31T00:35:03Z","updated_at":"2016-01-31T14:47:00Z","closed_at":"2016-01-31T10:57:27Z","pull_request":{"url":"https://api.github.com/repos/aasm/aasm/pulls/315","html_url":"https://github.com/aasm/aasm/pull/315","diff_url":"https://github.com/aasm/aasm/pull/315.diff","patch_url":"https://github.com/aasm/aasm/pull/315.patch"},"body":"Hi,\r\n\r\nI wanted to be able to use AASM in my new RubyMotion project.\r\nI fooled around a little to see if it was possible and by the time I was done with it I realised all specs were still valid. So I was wondering if you would be interested to merge that support back on your side ?\r\n\r\nBasically all I had to do is to remove all string-based eval-like code and replace them with a good old define_method. That and 2 minor changes on the persistence 'constantize' method and the list of required files by the gem. That's all.\r\n\r\nSo there it is !"},"comment":{"url":"https://api.github.com/repos/aasm/aasm/issues/comments/177514620","html_url":"https://github.com/aasm/aasm/pull/315#issuecomment-177514620","issue_url":"https://api.github.com/repos/aasm/aasm/issues/315","id":177514620,"user":{"login":"Infotaku","id":2786888,"avatar_url":"https://avatars.githubusercontent.com/u/2786888?v=3","gravatar_id":"","url":"https://api.github.com/users/Infotaku","html_url":"https://github.com/Infotaku","followers_url":"https://api.github.com/users/Infotaku/followers","following_url":"https://api.github.com/users/Infotaku/following{/other_user}","gists_url":"https://api.github.com/users/Infotaku/gists{/gist_id}","starred_url":"https://api.github.com/users/Infotaku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Infotaku/subscriptions","organizations_url":"https://api.github.com/users/Infotaku/orgs","repos_url":"https://api.github.com/users/Infotaku/repos","events_url":"https://api.github.com/users/Infotaku/events{/privacy}","received_events_url":"https://api.github.com/users/Infotaku/received_events","type":"User","site_admin":false},"created_at":"2016-01-31T14:47:00Z","updated_at":"2016-01-31T14:47:00Z","body":"@alto Glad you like it. \r\n\r\nRubyMotion does not support string-based runtime eval because it requires a full-blown interpreter. So you should avoid using class_eval, instance_eval and eval with anything other than blocks. That's why I had to change the way AASM defines its state-related methods and use define_method instead.\r\n\r\nAlso since RubyMotion has to compile the files, runtime require is not supported (you can still use it, but it will have no effect and the code won't be loaded). This is why I had to require the default persistence file (plain-persistence.rb) inside aasm.rb. So the 'motion-bundler' gem knows it has to add the file for compilation. This is not mandatory (motion-bundler offers some logic to specify missing files manually) but it's a nice to have and provides peace of minds for RubyMotion developers."}}