-
-
Save ndrluis/3e01878c0eba43b9d3b7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'native' | |
doc = Native(`document`) | |
puts %Q[Object instance of #{doc.body.class} for "#{doc.title}"] | |
puts %Q[Body DOM element class: "#{doc.body.className}"] | |
# => Object instance of Native::Object for "Try Opal: Browser compiler and REPL" | |
# => Body DOM element class: "try try_index" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'native' | |
class Body | |
include Native | |
alias_native :class_name, :className | |
end | |
class Document | |
include Native | |
alias_native :title | |
alias_native :body, :body, as: Body | |
end | |
doc = Document.new(`document`) | |
puts %Q[Object instance of #{doc.body.class} for "#{doc.title}"] | |
puts %Q[Body DOM element class: "#{doc.body.class_name}"] | |
# => Object instance of Body for "Try Opal: Browser compiler and REPL" | |
# => Body DOM element class: "try try_index" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment