Class: ConvenientService::Utils::Array::Rjust Private
- Inherits:
-
Support::Command
- Object
- Support::Command
- ConvenientService::Utils::Array::Rjust
- Defined in:
- lib/convenient_service/utils/array/rjust.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
- #array ⇒ Object readonly private
- #pad ⇒ Object readonly private
- #size ⇒ Object readonly private
Instance Method Summary collapse
- #call ⇒ Array private
- #initialize(array, size, pad = nil) ⇒ void constructor private
Methods inherited from Support::Command
Constructor Details
#initialize(array, size, pad = nil) ⇒ 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.
36 37 38 39 40 |
# File 'lib/convenient_service/utils/array/rjust.rb', line 36 def initialize(array, size, pad = nil) @array = array @size = size @pad = pad 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.
16 17 18 |
# File 'lib/convenient_service/utils/array/rjust.rb', line 16 def array @array end |
#pad ⇒ 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.
28 29 30 |
# File 'lib/convenient_service/utils/array/rjust.rb', line 28 def pad @pad end |
#size ⇒ 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/array/rjust.rb', line 22 def size @size end |
Instance Method Details
#call ⇒ Array
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.
45 46 47 48 49 50 51 |
# File 'lib/convenient_service/utils/array/rjust.rb', line 45 def call return array if size <= array.size count = size - array.size array + [pad] * count end |