Class: ConvenientService::Utils::Enumerable::FindLast Private
- Inherits:
-
Support::Command
- Object
- Support::Command
- ConvenientService::Utils::Enumerable::FindLast
- Defined in:
- lib/convenient_service/utils/enumerable/find_last.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.
Instance Attribute Summary collapse
- #block ⇒ Object readonly private
- #enumerable ⇒ Object readonly private
Instance Method Summary collapse
-
#call ⇒ Object
private
Can be any type.
- #initialize(enumerable, &block) ⇒ void constructor private
Methods inherited from Support::Command
Constructor Details
#initialize(enumerable, &block) ⇒ void
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.
29 30 31 32 |
# File 'lib/convenient_service/utils/enumerable/find_last.rb', line 29 def initialize(enumerable, &block) @enumerable = enumerable @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
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.
22 23 24 |
# File 'lib/convenient_service/utils/enumerable/find_last.rb', line 22 def block @block end |
#enumerable ⇒ Object (readonly)
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.
16 17 18 |
# File 'lib/convenient_service/utils/enumerable/find_last.rb', line 16 def enumerable @enumerable end |
Instance Method Details
#call ⇒ 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.
Works with custom ‘Enumerable` objects.
Returns Can be any type.
40 41 42 43 44 |
# File 'lib/convenient_service/utils/enumerable/find_last.rb', line 40 def call enumerable.reverse_each { |item| return item if block.call(item) } nil end |