Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversion method to_js does not work on Float? #212

Closed
sebnozzi opened this issue May 12, 2023 Discussed in #210 · 1 comment
Closed

Conversion method to_js does not work on Float? #212

sebnozzi opened this issue May 12, 2023 Discussed in #210 · 1 comment

Comments

@sebnozzi
Copy link

Discussed in #210

Originally posted by sebnozzi May 12, 2023
According to the documentation I should be able to call to_js in a Float value, right?

https://ruby.github.io/ruby.wasm/Float.html

Then why does this throw an error?

require "js"

(Math::PI).to_js

Output:

(file): eval:3:in `<main>': undefined method `to_js' for 3.141592653589793:Float (NoMethodError)
 (Exception)

Link:
https://try.ruby-lang.org/playground/#code=require+%22js%22%0A%0A(Math%3A%3API).to_js&engine=cruby-3.2.0

@kateinoigakukun
Copy link
Member

The TryRuby is a little bit old. Please try with the latest version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants