Class: ConvenientService::Utils::Array::FindYield
- Inherits:
-
Support::Command
- Object
- Support::Command
- ConvenientService::Utils::Array::FindYield
- Defined in:
- lib/convenient_service/utils/array/find_yield.rb
Overview
Instance Attribute Summary collapse
-
#array ⇒ Object
readonly
Returns the value of attribute array.
-
#block ⇒ Object
readonly
Returns the value of attribute block.
Instance Method Summary collapse
-
#call ⇒ Object?
Can be any type.
- #initialize(array, &block) ⇒ void constructor
Methods inherited from Support::Command
Constructor Details
#initialize(array, &block) ⇒ void
72 73 74 75 |
# File 'lib/convenient_service/utils/array/find_yield.rb', line 72 def initialize(array, &block) @array = array @block = block end |
Instance Attribute Details
#array ⇒ Object (readonly)
Returns the value of attribute array.
59 60 61 |
# File 'lib/convenient_service/utils/array/find_yield.rb', line 59 def array @array end |
#block ⇒ Object (readonly)
Returns the value of attribute block.
65 66 67 |
# File 'lib/convenient_service/utils/array/find_yield.rb', line 65 def block @block end |
Instance Method Details
#call ⇒ Object?
Returns Can be any type.
81 82 83 84 85 86 87 88 89 |
# File 'lib/convenient_service/utils/array/find_yield.rb', line 81 def call array.each do |item| block_value = block.call(item) return block_value if block_value end nil end |