Class: Array

Inherits:
Object show all
Includes:
ReactiveTags
Defined in:
lib/volt/extra_core/array.rb,
lib/volt/extra_core/blank.rb,
lib/volt/reactive/array_extensions.rb

Instance Method Summary collapse

Methods included from ReactiveTags

included, #reactive_method_tag

Instance Method Details

#+(val) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/volt/reactive/array_extensions.rb', line 5

def +(val)
  result = __old_plus(val.cur)
  if val.reactive? && !result.reactive?
    result = ReactiveValue.new(result)
  end

  return result
end

#__old_plusObject



3
# File 'lib/volt/reactive/array_extensions.rb', line 3

alias :__old_plus :+

#deep_curObject



11
12
13
14
15
16
17
18
# File 'lib/volt/extra_core/array.rb', line 11

def deep_cur
  new_array = []
  each do |item|
    new_array << item.deep_cur
  end

  return new_array
end

#sumObject



2
3
4
5
6
7
8
9
# File 'lib/volt/extra_core/array.rb', line 2

def sum
  total = 0
  self.each do |val|
    total += val
  end

  return total
end