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
29 30 31 32 |
# File 'lib/convenient_service/utils/array/keep_after.rb', line 29 def initialize(array, object) @array = array @object = object end |
Instance Attribute Details
#array ⇒ Object (readonly)
Returns the value of attribute array.
16 17 18 |
# File 'lib/convenient_service/utils/array/keep_after.rb', line 16 def array @array end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
22 23 24 |
# File 'lib/convenient_service/utils/array/keep_after.rb', line 22 def object @object end |
Instance Method Details
#call ⇒ Object?
Returns Can be any type.
38 39 40 41 42 |
# File 'lib/convenient_service/utils/array/keep_after.rb', line 38 def call return [] unless array.include?(object) Utils::Array.drop_while(array, inclusively: true) { |item| item != object } end |