Class: Hikithor::Command
- Inherits:
-
Object
- Object
- Hikithor::Command
- Defined in:
- lib/hikiutils_thor.rb
Instance Method Summary collapse
- #display_format(id, name, local, global, i_size, n_size, l_size, g_size) ⇒ Object
- #full_width_count(string) ⇒ Object
Instance Method Details
#display_format(id, name, local, global, i_size, n_size, l_size, g_size) ⇒ Object
279 280 281 282 283 284 285 286 |
# File 'lib/hikiutils_thor.rb', line 279 def display_format(id, name, local, global, i_size, n_size, l_size, g_size) name_length = n_size-full_width_count(name) local_length = l_size-full_width_count(local) global_string= global.size < g_size ? global : global[0..g_size] [id.to_s.rjust(i_size), name.ljust(name_length), local.ljust(local_length), global_string.ljust(g_size)].join(' | ') end |
#full_width_count(string) ⇒ Object
288 289 290 |
# File 'lib/hikiutils_thor.rb', line 288 def full_width_count(string) string.each_char.select{|char| !(/[ -~。-゚]/.match(char))}.count end |