Skip to content

Add to_b and to_h to JS::Object #346

Description

@terrablue

I would like to suggest adding to_b and to_h to JS::Object, to convert into a ruby boolean respective hash.

to_b → boolean
Converts self to true or false:

JS.eval("return true").to_b        # => true
JS.eval("return false").to_b       # => false

to_h → hash
Converts self to a Hash:

JS.eval("return {foo: 'bar'}").to_h         # => { "foo" => "bar" }

Activity

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

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