Class: Cmdlet::Str::Padl
- Inherits:
-
BaseCmdlet
- Object
- BaseCmdlet
- Cmdlet::Str::Padl
- Defined in:
- lib/cmdlet/str/padl.rb
Overview
Padl: take the value and give it padding on the left hand side
Instance Method Summary collapse
-
#call(value, count = nil, char = nil) ⇒ String
The value padded on LHS with [char (default ' ')] and [count (default 30)].
Methods inherited from BaseCmdlet
Instance Method Details
#call(value, count = nil, char = nil) ⇒ String
Returns the value padded on LHS with [char (default ' ')] and [count (default 30)].
13 14 15 16 17 18 19 |
# File 'lib/cmdlet/str/padl.rb', line 13 def call(value, count = nil, char = nil) value = '' if value.nil? count = KConfig.configuration.cmdlet.padl_count if count.nil? count = count.to_i if count.is_a?(String) char = KConfig.configuration.cmdlet.padl_char if char.nil? value.to_s.rjust(count, char) end |