Class: Array

Inherits:
Object show all
Defined in:
lib/h8/value.rb,
lib/h8/context.rb

Instance Method Summary collapse

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.

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