Class: Puppet::Pops::Types::Iterator Private
- Includes:
- Iterable
- Defined in:
- lib/puppet/pops/types/iterable.rb
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.
Direct Known Subclasses
Instance Method Summary collapse
- #all?(&block) ⇒ Boolean private
- #any?(&block) ⇒ Boolean private
- #element_type ⇒ Object private
-
#initialize(element_type, enumeration) ⇒ Iterator
constructor
private
A new instance of Iterator.
- #map(*args, &block) ⇒ Object private
- #method_missing(name, *arguments, &block) ⇒ Object private
- #next ⇒ Object private
- #reduce(*args, &block) ⇒ Object private
- #respond_to_missing?(name, include_private) ⇒ Boolean private
- #reverse_each(&block) ⇒ Object private
- #size ⇒ Object private
- #step(step, &block) ⇒ Object private
- #step_iterator(step) ⇒ Object private
- #to_s ⇒ Object private
- #unbounded? ⇒ Boolean private
Methods included from Iterable
asserted_iterable, #each, #hash_style?, on, #to_a, unbounded?
Constructor Details
#initialize(element_type, enumeration) ⇒ Iterator
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 a new instance of Iterator.
191 192 193 194 |
# File 'lib/puppet/pops/types/iterable.rb', line 191 def initialize(element_type, enumeration) @element_type = element_type @enumeration = enumeration end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *arguments, &block) ⇒ 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.
208 209 210 |
# File 'lib/puppet/pops/types/iterable.rb', line 208 def method_missing(name, *arguments, &block) @enumeration.send(name, *arguments, &block) end |
Instance Method Details
#all?(&block) ⇒ 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.
224 225 226 |
# File 'lib/puppet/pops/types/iterable.rb', line 224 def all?(&block) @enumeration.all?(&block) end |
#any?(&block) ⇒ 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.
228 229 230 |
# File 'lib/puppet/pops/types/iterable.rb', line 228 def any?(&block) @enumeration.any?(&block) end |
#element_type ⇒ 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/pops/types/iterable.rb', line 196 def element_type @element_type end |
#map(*args, &block) ⇒ 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.
216 217 218 |
# File 'lib/puppet/pops/types/iterable.rb', line 216 def map(*args, &block) @enumeration.map(*args, &block) end |
#next ⇒ 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.
212 213 214 |
# File 'lib/puppet/pops/types/iterable.rb', line 212 def next @enumeration.next end |
#reduce(*args, &block) ⇒ 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.
220 221 222 |
# File 'lib/puppet/pops/types/iterable.rb', line 220 def reduce(*args, &block) @enumeration.reduce(*args, &block) 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.
204 205 206 |
# File 'lib/puppet/pops/types/iterable.rb', line 204 def respond_to_missing?(name, include_private) @enumeration.respond_to?(name, include_private) end |
#reverse_each(&block) ⇒ 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.
252 253 254 255 |
# File 'lib/puppet/pops/types/iterable.rb', line 252 def reverse_each(&block) r = Iterator.new(@element_type, @enumeration.reverse_each) block_given? ? r.each(&block) : r end |
#size ⇒ 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 |
# File 'lib/puppet/pops/types/iterable.rb', line 200 def size @enumeration.size end |
#step(step, &block) ⇒ 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.
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/puppet/pops/types/iterable.rb', line 232 def step(step, &block) raise ArgumentError if step <= 0 r = self r = r.step_iterator(step) if step > 1 if block_given? begin if block.arity == 1 loop { yield(r.next) } else loop { yield(*r.next) } end rescue StopIteration end self else r end end |
#step_iterator(step) ⇒ 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.
257 258 259 |
# File 'lib/puppet/pops/types/iterable.rb', line 257 def step_iterator(step) StepIterator.new(@element_type, self, step) end |
#to_s ⇒ 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.
261 262 263 264 |
# File 'lib/puppet/pops/types/iterable.rb', line 261 def to_s et = element_type et.nil? ? 'Iterator-Value' : "Iterator[#{et.generalize}]-Value" end |
#unbounded? ⇒ 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.
266 267 268 |
# File 'lib/puppet/pops/types/iterable.rb', line 266 def unbounded? Iterable.unbounded?(@enumeration) end |