Parent

Class 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
 8:     def initialize
 9:       super()
10:     end

Public Instance Methods

<<(element) click to toggle source
    # File lib/hike/normalized_array.rb, line 24
24:     def <<(element)
25:       super normalize_element(element)
26:     end
[]=(*args) click to toggle source
    # File lib/hike/normalized_array.rb, line 12
12:     def []=(*args)
13:       value = args.pop
14: 
15:       if value.respond_to?(:to_ary)
16:         value = normalize_elements(value)
17:       else
18:         value = normalize_element(value)
19:       end
20: 
21:       super(*args.concat([value]))
22:     end
collect!() click to toggle source
    # File lib/hike/normalized_array.rb, line 28
28:     def collect!
29:       super do |element|
30:         result = yield element
31:         normalize_element(result)
32:       end
33:     end
Also aliased as: map!
insert(index, *elements) click to toggle source
    # File lib/hike/normalized_array.rb, line 37
37:     def insert(index, *elements)
38:       super index, *normalize_elements(elements)
39:     end
map!() click to toggle source
Alias for: collect!
normalize_elements(elements) click to toggle source
    # File lib/hike/normalized_array.rb, line 53
53:     def normalize_elements(elements)
54:       elements.map do |element|
55:         normalize_element(element)
56:       end
57:     end
push(*elements) click to toggle source
    # File lib/hike/normalized_array.rb, line 41
41:     def push(*elements)
42:       super(*normalize_elements(elements))
43:     end
replace(elements) click to toggle source
    # File lib/hike/normalized_array.rb, line 45
45:     def replace(elements)
46:       super normalize_elements(elements)
47:     end
unshift(*elements) click to toggle source
    # File lib/hike/normalized_array.rb, line 49
49:     def unshift(*elements)
50:       super(*normalize_elements(elements))
51:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.