Module: Kernel
- Defined in:
- opal/stdlib/pp.rb,
opal/stdlib/native.rb,
opal/stdlib/pathname.rb,
opal/stdlib/opal-parser.rb
Instance Method Summary collapse
- #Array(object, *args, &block) ⇒ Object
- #eval(str) ⇒ Object
- #Native(obj) ⇒ Object
- #native?(value) ⇒ Boolean
- #Pathname(path) ⇒ Object
- #pretty_inspect ⇒ Object
Instance Method Details
#Array(object, *args, &block) ⇒ Object
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'opal/stdlib/native.rb', line 130 def Array(object, *args, &block) %x{ if (object == null || object === nil) { return []; } else if (#{native?(object)}) { return #{Native::Array.new(object, *args, &block).to_a}; } else if (#{object.respond_to? :to_ary}) { return #{object.to_ary}; } else if (#{object.respond_to? :to_a}) { return #{object.to_a}; } else { return [object]; } } end |
#eval(str) ⇒ Object
7 8 9 10 |
# File 'opal/stdlib/opal-parser.rb', line 7 def eval(str) code = Opal.compile str `eval(#{code})` end |
#Native(obj) ⇒ Object
120 121 122 123 124 125 126 127 128 |
# File 'opal/stdlib/native.rb', line 120 def Native(obj) if `#{obj} == null` nil elsif native?(obj) Native::Object.new(obj) else obj end end |
#native?(value) ⇒ Boolean
116 117 118 |
# File 'opal/stdlib/native.rb', line 116 def native?(value) `value == null || !value._klass` end |
#Pathname(path) ⇒ Object
29 30 |
# File 'opal/stdlib/pathname.rb', line 29 def Pathname(path) end |
#pretty_inspect ⇒ Object
2 |
# File 'opal/stdlib/pp.rb', line 2 def pretty_inspect; inspect; end |