Class: Array

Inherits:
Object show all
Defined in:
lib/core_extensions.rb

Direct Known Subclasses

VariableArray

Instance Method Summary collapse

Instance Method Details

#matcher(opts = {}) ⇒ Object

call matcher on all of the elements



169
170
171
172
173
# File 'lib/core_extensions.rb', line 169

def matcher(opts = {})
  klone = self.clone
  klone.unshift(":matcher")
  VariableArray.new(klone.collect(&:matcher))
end

#pathify_stringsObject



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/core_extensions.rb', line 153

def pathify_strings
  if self.first == ":matcher"
    val = VariableArray.new(self)
  else
    val = self
  end
  val.each_with_index do |v,k|
    if v.is_a?(Array)  || v.is_a?(Hash)
      val[k] = v.pathify_strings
    elsif v.instance_of?(String) || v.is_a?(Numeric)
      val[k] = PathString.new(URI.decode(v.to_s))
    end
  end
  val
end