Class: PuppetX::Puppetlabs::Migration::OverviewModel::Query::WrappingArray Private
- Inherits:
-
Array
- Object
- Array
- PuppetX::Puppetlabs::Migration::OverviewModel::Query::WrappingArray
- 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
- #&(other_ary) ⇒ Object private
- #+(other_ary) ⇒ Object private
- #-(other_ary) ⇒ Object private
- #[](*args) ⇒ Object private
- #compact ⇒ Object private
- #dispatch(name) ⇒ Object private
- #drop(n) ⇒ Object private
- #exit_code ⇒ Object private
- #first(*args) ⇒ Object private
- #flatten ⇒ Object private
-
#message ⇒ Object
private
Should not be needed but Minitest::Assertions adds this method even though respond_to_missing? is implemented.
- #method_missing(name, *args) ⇒ Object private
- #of_class(eclass) ⇒ Object private
- #partition ⇒ Object private
- #pop(*args) ⇒ Object private
- #reject ⇒ Object private
- #respond_to_missing?(name, include_private) ⇒ Boolean private
- #reverse ⇒ Object private
- #select ⇒ Object private
- #slice(*args) ⇒ Object private
- #sort ⇒ Object private
- #sort_by ⇒ Object private
- #take(n) ⇒ Object private
- #uniq ⇒ Object private
- #|(other_ary) ⇒ Object private
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 |
#compact ⇒ 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.
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_code ⇒ 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.
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 |
#flatten ⇒ 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.
196 197 198 |
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 196 def flatten wrap(super) end |
#message ⇒ 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.
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 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 |
#partition ⇒ 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.
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 |
#reject ⇒ 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.
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.
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 |
#reverse ⇒ 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.
209 210 211 |
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 209 def reverse wrap(super) end |
#select ⇒ 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.
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 |
#sort ⇒ 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.
225 226 227 |
# File 'lib/puppet_x/puppetlabs/migration/overview_model/query.rb', line 225 def sort wrap(super) end |
#sort_by ⇒ 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.
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 |
#uniq ⇒ 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.
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 |