class 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
Source
# File lib/hike/normalized_array.rb, line 8 def initialize super() end
Calls superclass method
Public Instance Methods
Source
# File lib/hike/normalized_array.rb, line 24 def <<(element) super normalize_element(element) end
Calls superclass method
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
Calls superclass method
Source
# File lib/hike/normalized_array.rb, line 28 def collect! super do |element| result = yield element normalize_element(result) end end
Calls superclass method
Also aliased as: map!
Source
# File lib/hike/normalized_array.rb, line 37 def insert(index, *elements) super index, *normalize_elements(elements) end
Calls superclass method
Source
# File lib/hike/normalized_array.rb, line 53 def normalize_elements(elements) elements.map do |element| normalize_element(element) end end
Source
# File lib/hike/normalized_array.rb, line 41 def push(*elements) super(*normalize_elements(elements)) end
Calls superclass method
Source
# File lib/hike/normalized_array.rb, line 45 def replace(elements) super normalize_elements(elements) end
Calls superclass method
Source
# File lib/hike/normalized_array.rb, line 49 def unshift(*elements) super(*normalize_elements(elements)) end
Calls superclass method