Class: PuppetX::Puppetlabs::Migration::OverviewModel::Query::WrappingArray Private

Inherits:
Array
  • Object
show all
Defined in:
lib/puppet_x/puppetlabs/migration/overview_model/query.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Wraps an Array<Wrapper> and gives it the ability to navigate its relationships as they were normal attributes of the class. Also ensures that any method that returns a subset of the array is wrapped

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



255
256
257
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 255

def method_missing(name, *args)
  args.empty? ? dispatch(name) : super
end

Class Method Details

.from_entities(overview, entities) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



153
154
155
156
157
158
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 153

def self.from_entities(overview, entities)
  entities.flatten!
  entities.uniq!
  entities.compact!
  new(entities.map { |entity| Wrapper.new(overview, entity) })
end

Instance Method Details

#&(other_ary) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



168
169
170
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 168

def &(other_ary)
  wrap(super)
end

#+(other_ary) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



164
165
166
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 164

def +(other_ary)
  wrap(super)
end

#-(other_ary) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



176
177
178
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 176

def -(other_ary)
  wrap(super)
end

#[](*args) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



180
181
182
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 180

def [](*args)
  wrap(super)
end

#compactObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



184
185
186
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 184

def compact
  wrap(super)
end

#dispatch(name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



259
260
261
262
263
264
265
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 259

def dispatch(name)
  arr = map { |entity| entity.send(name) }
  arr.compact!
  arr.flatten!
  arr.uniq!
  WrappingArray.new(arr)
end

#drop(n) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



188
189
190
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 188

def drop(n)
  wrap(super)
end

#exit_codeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



247
248
249
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 247

def exit_code
  dispatch(:exit_code)
end

#first(*args) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



192
193
194
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 192

def first(*args)
  wrap(super)
end

#flattenObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



196
197
198
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 196

def flatten
  wrap(super)
end

#messageObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Should not be needed but Minitest::Assertions adds this method even though respond_to_missing? is implemented



243
244
245
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 243

def message
  dispatch(:message)
end

#of_class(eclass) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



160
161
162
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 160

def of_class(eclass)
  select { |entity| entity.entity.is_a?(eclass) }
end

#partitionObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



200
201
202
203
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 200

def partition
  parts = super
  [wrap(parts[0]), wrap(parts[1])]
end

#pop(*args) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



213
214
215
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 213

def pop(*args)
  wrap(super)
end

#rejectObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



205
206
207
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 205

def reject
  wrap(super)
end

#respond_to_missing?(name, include_private) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


251
252
253
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 251

def respond_to_missing?(name, include_private)
  true # We dispatch all unknown messages to each instance
end

#reverseObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



209
210
211
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 209

def reverse
  wrap(super)
end

#selectObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



221
222
223
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 221

def select
  wrap(super)
end

#slice(*args) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



217
218
219
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 217

def slice(*args)
  wrap(super)
end

#sortObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



225
226
227
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 225

def sort
  wrap(super)
end

#sort_byObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



229
230
231
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 229

def sort_by
  wrap(super)
end

#take(n) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



233
234
235
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 233

def take(n)
  wrap(super)
end

#uniqObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



237
238
239
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 237

def uniq
  wrap(super)
end

#|(other_ary) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



172
173
174
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 172

def |(other_ary)
  wrap(super)
end