Class: Array
Instance Method Summary collapse
-
#__js_select(callable) ⇒ Object
JS select() implementation.
-
#indexOf(item) ⇒ Object
JS indexOf implementation.
-
#splice(start, len, *replace) ⇒ Object
JS splice() implementation.
-
#to_ruby(depth = 0) ⇒ Object
New array with all components converted to_ruby.
Instance Method Details
#__js_select(callable) ⇒ Object
JS select() implementation
9 10 11 12 13 |
# File 'lib/h8/context.rb', line 9 def __js_select callable select { |item| callable.call item } end |
#indexOf(item) ⇒ Object
JS indexOf implementation
16 17 18 |
# File 'lib/h8/context.rb', line 16 def indexOf item index(item) || -1 end |
#splice(start, len, *replace) ⇒ Object
JS splice() implementation
21 22 23 24 25 |
# File 'lib/h8/context.rb', line 21 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 |