Class: ConvenientService::Utils::Array::KeepAfter
- Inherits:
-
Support::Command
- Object
- Support::Command
- ConvenientService::Utils::Array::KeepAfter
- Defined in:
- lib/convenient_service/utils/array/keep_after.rb
Instance Attribute Summary collapse
-
#array ⇒ Object
readonly
Returns the value of attribute array.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
-
#call ⇒ Object?
Can be any type.
- #initialize(array, object) ⇒ void constructor
Methods inherited from Support::Command
Constructor Details
#initialize(array, object) ⇒ void
24 25 26 27 |
# File 'lib/convenient_service/utils/array/keep_after.rb', line 24 def initialize(array, object) @array = array @object = object end |
Instance Attribute Details
#array ⇒ Object (readonly)
Returns the value of attribute array.
11 12 13 |
# File 'lib/convenient_service/utils/array/keep_after.rb', line 11 def array @array end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
17 18 19 |
# File 'lib/convenient_service/utils/array/keep_after.rb', line 17 def object @object end |
Instance Method Details
#call ⇒ Object?
Returns Can be any type.
33 34 35 36 37 |
# File 'lib/convenient_service/utils/array/keep_after.rb', line 33 def call return [] unless array.include?(object) Utils::Array.drop_while(array, inclusively: true) { |item| item != object } end |