my_help 1.2.7 → 1.2.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb657df4836581b1f682cf5cffabdb89215f4f6f51a5836aa2dfdb7d86d11a20
4
- data.tar.gz: 8e2d7673d363db127caeba1323837a7a2a1ef989f25461ec0dd28ee33f594d7c
3
+ metadata.gz: 3194975e829d7fbb8daad82df834fd8a099a4aa5123be744a10fb60cc2cbf79f
4
+ data.tar.gz: 1e4023bdc4823e9c6c648412a380af584eb322fd1f5df73ed6f774db8fe247b6
5
5
  SHA512:
6
- metadata.gz: 41f84a96ab9e2b1794805587c13c14489e3e85f849d756875e0f1a0bf0fe780db5e009adebbac32efa0b85ce1209e21d8b4d54d4ebe546c2edfd590b4d789f49
7
- data.tar.gz: 3309a3cfd356061482fae41107396fb9a319e0b9a6bc4dd2e98fa88048ed044f2f2c29a37aadfc3ed9f8e9acb32cba2724e29cff09f3eedbd6d33af7702ec661
6
+ metadata.gz: 7e76173eca3a142bf25d7d28b7867d038e131ca7f00650c36ca17abd3a98a0373759fcb3e348c9cedd426d5d43db4971ead8837e950eea3a0e34a0443bbe8db2
7
+ data.tar.gz: 489b68bc28669f05bff539f3cc34fef7b5df7554b898506c96f8039138fd357e398b68e5dcd85e650e81f6633d248f57f94627891d521fb324ef2cc4c8030aa0
data/lib/my_help/list.rb CHANGED
@@ -37,18 +37,17 @@ module MyHelp
37
37
  head = help_info[:items]["head"] ?
38
38
  help_info[:items]["head"].split("\n")[0] : ''
39
39
  # "head "ではだめ...やれやれ<24/10/02> revised
40
- out << "%10s: %s\n" % [help_info[:name], head]
40
+ # out << "%10s: %s\n" % [help_info[:name], head]
41
41
  # out << "%s: %s\n" % [help_info[:name], head]
42
- # out << "%20s: %s\n" % [pad_with_bytes(help_info[:name],20), head]
42
+ out << "%s: %s\n" % [pad_with_bytes(help_info[:name],20), head]
43
43
  end
44
44
  end
45
45
 
46
46
  def pad_with_bytes(str, length, padstr=" ")
47
- p str="日本語"
48
- p str_bytes = str.bytesize
49
- p pad_bytes = length - str_bytes
50
- p pad = padstr * (pad_bytes / padstr.bytesize)
51
- exit
47
+ str_bytes = str.each_char.map do |c|
48
+ c.bytesize == 1 ? 1 : 2
49
+ end.reduce(0, &:+)
50
+ pad = padstr * (length - str_bytes)
52
51
  return pad + str
53
52
  end
54
53
 
@@ -63,8 +62,8 @@ module MyHelp
63
62
  @help_info[:items].each_pair do |item, val|
64
63
  item, desc = item.split(":")
65
64
  desc ||= ""
66
- output << "- %20s : %s\n" % [item, desc]
67
- # output << "%s: %s\n" % [pad_with_bytes(item, 40), desc]
65
+ # output << "- %20s : %s\n" % [item, desc]
66
+ output << "%s: %s\n" % [pad_with_bytes(item, 20), desc]
68
67
  end
69
68
  else
70
69
  output << find_near(item)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MyHelp
4
- VERSION = "1.2.7"
4
+ VERSION = "1.2.8"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: my_help
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.7
4
+ version: 1.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shigeto R. Nishiani