Skip to content

Conversion method to_js does not work on Float? #212

Closed
@sebnozzi

Description

@sebnozzi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions