Class: Array
Instance Method Summary collapse
- #_select_js(callable) ⇒ Object
- #indexOf(item) ⇒ Object
- #splice(start, len, *replace) ⇒ Object
-
#to_ruby(depth = 0) ⇒ Object
New array with all components converted to_ruby.
Instance Method Details
#_select_js(callable) ⇒ Object
8 9 10 11 12 |
# File 'lib/h8/context.rb', line 8 def _select_js callable select { |item| callable.call item } end |
#indexOf(item) ⇒ Object
14 15 16 |
# File 'lib/h8/context.rb', line 14 def indexOf item index(item) || -1 end |
#splice(start, len, *replace) ⇒ Object
18 19 20 21 22 |
# File 'lib/h8/context.rb', line 18 def splice(start, len, *replace) ret = self[start, len] self[start, len] = replace ret end |
#to_ruby(depth = 0) ⇒ Object
Returns new array with all components converted to_ruby.
213 214 215 216 |
# File 'lib/h8/value.rb', line 213 def to_ruby depth=0 depth += 1 map { |x| x.to_ruby depth } end |