Module: Enumerable
- Included in:
- Ruber::AnnotationModel, Ruber::ComponentManager, Ruber::Pane, Ruber::ProjectFiles, Ruber::World::DocumentList, Ruber::World::ProjectList
- Defined in:
- lib/ruber/utils.rb
Instance Method Summary collapse
-
#find! { ... } ⇒ Object?
(also: #find_and_map)
Finds the first element for which the block returns a true value and returns the value of the block.
Instance Method Details
#find! { ... } ⇒ Object? Also known as: find_and_map
Finds the first element for which the block returns a true value and returns the value of the block
It works like @Enumerable#find@, but, instead of returning the element for which the block returned a true value, it returns the value returned by the block. if the block returns nil or false for all elements
316 317 318 319 320 321 322 |
# File 'lib/ruber/utils.rb', line 316 def find! each do |obj| res = yield obj return res if res end nil end |