1
0
Fork 0
mirror of https://github.com/rubyjs/therubyracer synced 2023-03-27 23:21:42 -04:00
therubyracer/ext/v8/bool.h
Georgy Angelov d1e9088cf0 Port a ton of the original ext classes
You can now create a JS object from Ruby-land without segfaulting
2015-03-20 20:47:57 +00:00

19 lines
328 B
C++

#ifndef RR_BOOL
#define RR_BOOL
namespace rr {
class Bool : public Equiv {
public:
Bool(VALUE val) : Equiv(val) {}
Bool(bool b) : Equiv(b ? Qtrue : Qfalse) {}
Bool(v8::Handle<v8::Boolean> b) : Equiv(b->Value() ? Qtrue : Qfalse) {}
inline operator bool() {
return RTEST(value);
}
};
}
#endif