Sha256: 06a10214918993a6880f6b3e8ca7e36c9ecc7956053fd1404149136a0cf2417a

Contents?: true

Size: 437 Bytes

Versions: 64

Compression:

Stored size: 437 Bytes

Contents

# encoding: utf-8

# String
class String
  # get spacing string
  #
  # === Example
  #
  # input
  #   hoge = 'hoge'
  #   hoge.spacing # => 'h o g e'
  #   hoge.spacing({char: '_', size: 2}) # => 'h__o__g__e'
  #
  def spacing(options = { char: ' ', size: 1 })
    options[:char] = ' ' unless options[:char]
    options[:size] = 1 unless options[:size]
    chars.to_a.join(options[:char] * options[:size])
  end
end

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
tbpgr_utils-0.0.151 lib/open_classes/string/spacing.rb
tbpgr_utils-0.0.150 lib/open_classes/string/spacing.rb
tbpgr_utils-0.0.149 lib/open_classes/string/spacing.rb
tbpgr_utils-0.0.148 lib/open_classes/string/spacing.rb
tbpgr_utils-0.0.147 lib/open_classes/string/spacing.rb
tbpgr_utils-0.0.146 lib/open_classes/string/spacing.rb
tbpgr_utils-0.0.145 lib/open_classes/string/spacing.rb
tbpgr_utils-0.0.144 lib/open_classes/string/spacing.rb
tbpgr_utils-0.0.143 lib/open_classes/string/spacing.rb
tbpgr_utils-0.0.142 lib/open_classes/string/spacing.rb
tbpgr_utils-0.0.141 lib/open_classes/string/spacing.rb
tbpgr_utils-0.0.140 lib/open_classes/string/spacing.rb
tbpgr_utils-0.0.139 lib/open_classes/string/spacing.rb
tbpgr_utils-0.0.138 lib/open_classes/string/spacing.rb
tbpgr_utils-0.0.137 lib/open_classes/string/spacing.rb
tbpgr_utils-0.0.136 lib/open_classes/string/spacing.rb
tbpgr_utils-0.0.135 lib/open_classes/string/spacing.rb
tbpgr_utils-0.0.134 lib/open_classes/string/spacing.rb
tbpgr_utils-0.0.133 lib/open_classes/string/spacing.rb
tbpgr_utils-0.0.132 lib/open_classes/string/spacing.rb