Parent

Class/Module Index [+]

Quicksearch

Hike::NormalizedArray

`NormalizedArray` is an internal abstract wrapper class that calls a callback `normalize_element` anytime an element is added to the Array.

`Extensions` and `Paths` are subclasses of `NormalizedArray`.

Public Class Methods

new() click to toggle source
# File lib/hike/normalized_array.rb, line 8
def initialize
  super()
end

Public Instance Methods

<<(element) click to toggle source
# File lib/hike/normalized_array.rb, line 24
def <<(element)
  super normalize_element(element)
end
[]=(*args) click to toggle source
# File lib/hike/normalized_array.rb, line 12
def []=(*args)
  value = args.pop

  if value.respond_to?(:to_ary)
    value = normalize_elements(value)
  else
    value = normalize_element(value)
  end

  super(*args.concat([value]))
end
collect!() click to toggle source
# File lib/hike/normalized_array.rb, line 28
def collect!
  super do |element|
    result = yield element
    normalize_element(result)
  end
end
Also aliased as: map!
insert(index, *elements) click to toggle source
# File lib/hike/normalized_array.rb, line 37
def insert(index, *elements)
  super index, *normalize_elements(elements)
end
map!() click to toggle source
Alias for: collect!
normalize_elements(elements) click to toggle source
# File lib/hike/normalized_array.rb, line 53
def normalize_elements(elements)
  elements.map do |element|
    normalize_element(element)
  end
end
push(*elements) click to toggle source
# File lib/hike/normalized_array.rb, line 41
def push(*elements)
  super(*normalize_elements(elements))
end
replace(elements) click to toggle source
# File lib/hike/normalized_array.rb, line 45
def replace(elements)
  super normalize_elements(elements)
end
unshift(*elements) click to toggle source
# File lib/hike/normalized_array.rb, line 49
def unshift(*elements)
  super(*normalize_elements(elements))
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.