Class: ConvenientService::Utils::Array::LimitedPush Private
- Inherits:
-
Support::Command
- Object
- Support::Command
- ConvenientService::Utils::Array::LimitedPush
- Defined in:
- lib/convenient_service/utils/array/limited_push.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.
Defined Under Namespace
Modules: Constants
Instance Attribute Summary collapse
- #array ⇒ Object readonly private
- #limit ⇒ Object readonly private
- #object ⇒ Object readonly private
Instance Method Summary collapse
- #call ⇒ Array<Object> private
- #initialize(array, object, limit: Constants::DEFAULT_LIMIT) ⇒ void constructor private
Methods inherited from Support::Command
Constructor Details
#initialize(array, object, limit: Constants::DEFAULT_LIMIT) ⇒ 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.
42 43 44 45 46 |
# File 'lib/convenient_service/utils/array/limited_push.rb', line 42 def initialize(array, object, limit: Constants::DEFAULT_LIMIT) @array = array @object = object @limit = limit end |
Instance Attribute Details
#array ⇒ 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.
23 24 25 |
# File 'lib/convenient_service/utils/array/limited_push.rb', line 23 def array @array end |
#limit ⇒ 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.
35 36 37 |
# File 'lib/convenient_service/utils/array/limited_push.rb', line 35 def limit @limit end |
#object ⇒ 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.
29 30 31 |
# File 'lib/convenient_service/utils/array/limited_push.rb', line 29 def object @object end |
Instance Method Details
#call ⇒ Array<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.
51 52 53 54 55 |
# File 'lib/convenient_service/utils/array/limited_push.rb', line 51 def call return array if array.size >= limit array.push(object) end |