Skip to content

Instantly share code, notes, and snippets.

@cj

cj/component.rb Secret

Created September 29, 2014 02:36
Show Gist options
  • Save cj/94a91f08bf3a16d8f21e to your computer and use it in GitHub Desktop.
Save cj/94a91f08bf3a16d8f21e to your computer and use it in GitHub Desktop.
content + <<-EOF
<script>
$(function(){
Opal.#{component.class}.$new().$#{action}(#{options.to_json})
});
</script>
EOF
js = <<-EOF
Document.ready? do
#{component.class}.new.#{action}(JSON.parse('#{options.to_json}'))
end
EOF
content + ("<script>" + Opal.compile(js) + "</script>")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment