Class: Yast::StringClass
- Inherits:
-
Module
- Object
- Module
- Yast::StringClass
- Includes:
- Logger
- Defined in:
- ../../src/modules/String.rb
Constant Summary
- UPPER_CHARS =
Note:
it is ascii chars only
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- LOWER_CHARS =
"abcdefghijklmnopqrstuvwxyz"
- ALPHA_CHARS =
UPPER_CHARS + LOWER_CHARS
- DIGIT_CHARS =
"0123456789"
- ALPHA_NUM_CHARS =
ALPHA_CHARS + DIGIT_CHARS
- PUNCT_CHARS =
"!\"\#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
- GRAPHICAL_CHARS =
ALPHA_NUM_CHARS + PUNCT_CHARS
- SPACE_CHARS =
"\f\r\n\t\v"
- PRINTABLE_CHARS =
SPACE_CHARS + GRAPHICAL_CHARS
Instance Method Summary (collapse)
-
- (Object) CAlnum
The 62 upper and lowercase ASCII letters and digits.
-
- (Object) CAlpha
The 52 upper and lowercase ASCII letters.
-
- (Object) CDigit
Digits: 0123456789.
-
- (Object) CGraph
Printable ASCII charcters except whitespace, 33-126.
-
- (Object) CLower
The 26 lowercase ASCII letters.
-
- (Object) CPrint
Printable ASCII characters including whitespace.
-
- (Object) CutBlanks(input)
deprecated
Deprecated.
if remove also n then use String#strip, otherwise simple sub is enough
-
- (String) CutRegexMatch(input, regex, glob)
Remove first or every match of given regular expression from a string.
-
- (String) CutZeros(input)
deprecated
Deprecated.
if conversion to integer is needed in decimal use String#to_i
-
- (String) EscapeTags(text)
Function for escaping (replacing) (HTML|XML…) tags with their (HTML|XML…) meaning.
-
- (Object) FindMountPoint(dir, dirs)
Find a mount point for given directory/file path.
-
- (Object) FirstChunk(s, separators)
Shorthand for select (splitstring (s, separators), 0, “”) Useful now that the above produces a deprecation warning.
-
- (String) FormatFilename(file_path, len)
Format file name - truncate the middle part of the directory to fit to the reqested lenght.
-
- (String) FormatRateMessage(text, avg_bps, curr_bps)
Add a download rate status to a message.
-
- (Object) FormatSize(bytes)
Return a pretty description of a byte count.
-
- (Object) FormatSizeWithPrecision(bytes, precision, omit_zeroes)
Return a pretty description of a byte count.
-
- (String) FormatTime(seconds)
Format an integer seconds value with min:sec or hours:min:sec.
-
- (String) FormatTwoDigits(x)
Format an integer number as (at least) two digits; use leading zeroes if necessary.
- - (Object) main
-
- (Object) NewlineItems(s)
The items as a list, with empty lines removed.
-
- (Object) NonEmpty(l)
Only non-“” items.
-
- (Object) OptParens(s)
Optional parenthesized text.
-
- (Object) Pad(text, length)
Add spaces after the text to make it long enough.
-
- (Object) PadZeros(text, length)
Add zeros before the text to make it long enough.
-
- (Array<String>) ParseOptions(options, parameters)
Parse string of values.
-
- (Object) Quote(var)
Quote a string with 's.
-
- (Object) Random(len)
Make a random base-36 number.
-
- (String) RemoveShortcut(label)
Remove a shortcut from a label, so that it can be inserted into help to avoid risk of different translation of the label.
-
- (String) Repeat(text, number)
deprecated
Deprecated.
use String#operator* instead
-
- (String) Replace(s, source, target)
Replace substring in a string.
-
- (Object) StartsWith(str, test)
Checks whether string str starts with test.
-
- (Object) SuperPad(text, length, padding, alignment)
Add the padding character around the text to make it long enough.
-
- (String) TextTable(header, items, options)
Function creates text table without using HTML tags.
-
- (String) UnderlinedHeader(header_line, left_padding)
Function returns underlined text header without using HTML tags.
-
- (Object) UnQuote(var)
Unquote a string with 's (quoted with quote).
-
- (String) ValidCharsFilename
Characters valid in a filename (not pathname).
-
- (Boolean) YesNo(value)
Value as “Yes” or “No”.
Instance Method Details
- (Object) CAlnum
The 62 upper and lowercase ASCII letters and digits
580 581 582 |
# File '../../src/modules/String.rb', line 580 def CAlnum ALPHA_NUM_CHARS end |
- (Object) CAlpha
The 52 upper and lowercase ASCII letters
570 571 572 |
# File '../../src/modules/String.rb', line 570 def CAlpha ALPHA_CHARS end |
- (Object) CDigit
Digits: 0123456789
575 576 577 |
# File '../../src/modules/String.rb', line 575 def CDigit DIGIT_CHARS end |
- (Object) CGraph
Printable ASCII charcters except whitespace, 33-126
585 586 587 |
# File '../../src/modules/String.rb', line 585 def CGraph GRAPHICAL_CHARS end |
- (Object) CLower
The 26 lowercase ASCII letters
565 566 567 |
# File '../../src/modules/String.rb', line 565 def CLower LOWER_CHARS end |
- (Object) CPrint
Printable ASCII characters including whitespace
590 591 592 |
# File '../../src/modules/String.rb', line 590 def CPrint PRINTABLE_CHARS end |
- (Object) CutBlanks(input)
if remove also n then use String#strip, otherwise simple sub is enough
Remove spaces and tabs at begin and end of input string.
256 257 258 259 260 |
# File '../../src/modules/String.rb', line 256 def CutBlanks(input) return "" if input.nil? input.sub(/\A[ \t]*(.*[^ \t])[ \t]*\z/, "\\1") end |
- (String) CutRegexMatch(input, regex, glob)
Remove first or every match of given regular expression from a string
(e.g. CutRegexMatch( “abcdef12ef34gh000”, “[0-9]+”, true ) -> “abcdefefgh”, CutRegexMatch( “abcdef12ef34gh000”, “[0-9]+”, false ) -> “abcdefef34gh000”)
518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 |
# File '../../src/modules/String.rb', line 518 def CutRegexMatch(input, regex, glob) return "" if input.nil? || input.empty? output = input if Builtins.regexpmatch(output, regex) p = Builtins.regexppos(output, regex) loop do first_index = p[0] lenght = p[1] || 0 output = output[0, first_index] + output[(first_index + lenght)..-1] p = Builtins.regexppos(output, regex) break unless glob break if p.empty? end end output end |
- (String) CutZeros(input)
if conversion to integer is needed in decimal use String#to_i
Remove any leading zeros
Remove any leading zeros that make tointeger inadvertently assume an octal number (e.g. “09” -> “9”, “0001” -> “1”, but “0” -> “0”)
271 272 273 274 275 |
# File '../../src/modules/String.rb', line 271 def CutZeros(input) return "" if input.nil? input.sub(/\A0*([0-9])/, "\\1") end |
- (String) EscapeTags(text)
Function for escaping (replacing) (HTML|XML…) tags with their (HTML|XML…) meaning.
Usable to present text “as is” in RichText.
543 544 545 546 547 548 549 550 551 552 |
# File '../../src/modules/String.rb', line 543 def EscapeTags(text) return nil unless text text = text.dup text.gsub!("&", "&") text.gsub!("<", "<") text.gsub!(">", ">") text end |
- (Object) FindMountPoint(dir, dirs)
Find a mount point for given directory/file path. Returns “/” if no mount point matches
783 784 785 786 787 788 789 790 791 792 793 794 795 |
# File '../../src/modules/String.rb', line 783 def FindMountPoint(dir, dirs) dirs = deep_copy(dirs) while !dir.nil? && dir != "" && !Builtins.contains(dirs, dir) # strip the last path component and try it again comps = Builtins.splitstring(dir, "/") comps = Builtins.remove(comps, Ops.subtract(Builtins.size(comps), 1)) dir = Builtins.mergestring(comps, "/") end dir = "/" if dir.nil? || dir == "" dir end |
- (Object) FirstChunk(s, separators)
Shorthand for select (splitstring (s, separators), 0, “”) Useful now that the above produces a deprecation warning.
559 560 561 562 |
# File '../../src/modules/String.rb', line 559 def FirstChunk(s, separators) return "" if !s || !separators s[/\A[^#{separators}]*/] end |
- (String) FormatFilename(file_path, len)
Format file name - truncate the middle part of the directory to fit to the reqested lenght. Path elements in the middle of the string are replaced by ellipsis (…). The result migth be longer that requested size if size of the last element (with ellipsis) is longer than the requested size. If the requested size is greater than size of the input then the string is not modified. The last part (file name) is never removed.
719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 |
# File '../../src/modules/String.rb', line 719 def FormatFilename(file_path, len) return nil unless file_path return file_path if len && len > file_path.size dir = file_path.split("/", -1) file = dir.pop # there is a slash at the end, add the directory name file = dir.pop + "/" if file == "" if dir.join("/").size <= 3 # the path is short, replacing by ... cannot help return file_path end ret = "" loop do # ellipsis - used to replace part of text to make it shorter # example: "/really/very/long/file/name", "/.../file/name") ellipsis = _("...") dir[dir.size / 2] = ellipsis ret = (dir + [file]).join("/") break unless len # funny backward compatibility that for nil len remove one element if ret.size > len # still too long, remove the ellipsis and start a new iteration dir.delete(ellipsis) else # the size is OK break end break if dir.empty? end ret end |
- (String) FormatRateMessage(text, avg_bps, curr_bps)
Add a download rate status to a message.
Add the current and the average download rate to the message.
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
# File '../../src/modules/String.rb', line 188 def FormatRateMessage(text, avg_bps, curr_bps) rate = "" curr_bps ||= 0 avg_bps ||= 0 if curr_bps > 0 rate = format_rate(curr_bps) if avg_bps > 0 # format download rate message: %1 = the current download rate (e.g. "242.6kB/s") # %2 is the average download rate (e.g. "228.3kB/s") # to translators: keep translation of "on average" as short as possible rate = Builtins.sformat( _("%1 (on average %2)"), rate, format_rate(avg_bps) ) end end # add download rate to the downloading message # %1 is URL, %2 is formatted download rate, e.g. "242.6kB/s (avg. 228.3kB/s)" # in ncurses UI the strings are exchanged (%1 is the rate, %2 is URL) # due to limited space on the screen Builtins.sformat(text, rate) end |
- (Object) FormatSize(bytes)
Return a pretty description of a byte count
Return a pretty description of a byte count, with two fraction digits and using B, KiB, MiB, GiB or TiB as unit as appropriate.
Uses the current locale defined decimal separator (i.e. the result is language dependant).
172 173 174 175 176 177 |
# File '../../src/modules/String.rb', line 172 def FormatSize(bytes) return "" unless bytes # automatic precision, don't print trailing zeroes for sizes < 1MiB FormatSizeWithPrecision(bytes, -1, Ops.less_than(bytes, 1 << 20)) end |
- (Object) FormatSizeWithPrecision(bytes, precision, omit_zeroes)
Return a pretty description of a byte count
Return a pretty description of a byte count with required precision and using B, KiB, MiB, GiB or TiB as unit as appropriate.
Uses the current locale defined decimal separator (i.e. the result is language dependant).
(useful for memory size - 128 MiB RAM looks better than 128.00 MiB RAM)
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File '../../src/modules/String.rb', line 122 def FormatSizeWithPrecision(bytes, precision, omit_zeroes) return "" if bytes.nil? units = [ # Byte abbreviated _("B"), # KiloByte abbreviated _("KiB"), # MegaByte abbreviated _("MiB"), # GigaByte abbreviated _("GiB"), # TeraByte abbreviated _("TiB") ] index = 0 whole = bytes.to_f while (whole >= 1024.0 || whole <= -1024.0) && (index + 1) < units.size whole /= 1024.0 index += 1 end precision ||= 0 # auto precision - depends on the suffix, but max. 3 decimal digits precision = index < 3 ? index : 3 if precision < 0 if omit_zeroes == true max_difference = 0.9 max_difference /= (10.0 * precision) precision = 0 if (whole - whole.round).abs < max_difference end Builtins::Float.tolstring(whole, precision) + " " + units[index] end |
- (String) FormatTime(seconds)
Format an integer seconds value with min:sec or hours:min:sec
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File '../../src/modules/String.rb', line 229 def FormatTime(seconds) return "nil:nil:nil" unless seconds # funny backward compatibility return "" if seconds < 0 if seconds < 3600 # Less than one hour return Builtins.sformat( "%1:%2", FormatTwoDigits(seconds / 60), FormatTwoDigits(seconds % 60) ) # More than one hour - we don't hope this will ever happen, but who knows? else hours = seconds / 3600 seconds = seconds % 3600 return Builtins.sformat( "%1:%2:%3", hours, FormatTwoDigits(seconds / 60), FormatTwoDigits(seconds % 60) ) end end |
- (String) FormatTwoDigits(x)
Format an integer number as (at least) two digits; use leading zeroes if necessary.
220 221 222 223 |
# File '../../src/modules/String.rb', line 220 def FormatTwoDigits(x) msg = (0..9).member?(x) ? "0%1" : "%1" Builtins.sformat(msg, x) end |
- (Object) main
47 48 49 |
# File '../../src/modules/String.rb', line 47 def main textdomain "base" end |
- (Object) NewlineItems(s)
Returns the items as a list, with empty lines removed
91 92 93 94 95 |
# File '../../src/modules/String.rb', line 91 def NewlineItems(s) return nil unless s NonEmpty(s.split("\n")) end |
- (Object) NonEmpty(l)
Returns only non-“” items
84 85 86 87 |
# File '../../src/modules/String.rb', line 84 def NonEmpty(l) return nil unless l l.reject { |i| i == "" } end |
- (Object) OptParens(s)
Optional parenthesized text
78 79 80 |
# File '../../src/modules/String.rb', line 78 def OptParens(s) opt_format(" (%1)", s) end |
- (Object) Pad(text, length)
Add spaces after the text to make it long enough
Add spaces after the text to make it long enough. If the text is longer than requested, no changes are made.
322 323 324 |
# File '../../src/modules/String.rb', line 322 def Pad(text, length) SuperPad(text, length, " ", :left) end |
- (Object) PadZeros(text, length)
Add zeros before the text to make it long enough.
Add zeros before the text to make it long enough. If the text is longer than requested, no changes are made.
334 335 336 |
# File '../../src/modules/String.rb', line 334 def PadZeros(text, length) SuperPad(text, length, "0", :right) end |
- (Array<String>) ParseOptions(options, parameters)
Parse string of values
Parse string of values - split string to values, quoting and backslash sequences are supported “separator”:<string> - value separator (default: “ t”), “unique”:<boolean> - result will not contain any duplicates, first occurance of the string is stored into output (default: false), “interpret_backslash”:<boolean> - convert backslash sequence into one character (e.g. “n” => “n”) (default: true) “remove_whitespace”:<boolean> - remove white spaces around values (default: true),
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 |
# File '../../src/modules/String.rb', line 348 def ParseOptions(, parameters) parameters ||= {} ret = [] # parsing options separator = parameters["separator"] || " \t" unique = parameters.fetch("unique", false) interpret_backslash = parameters.fetch("interpret_backslash", true) remove_whitespace = parameters.fetch("remove_whitespace", true) log.debug "Input: string: '#{}', parameters: #{parameters}" return [] unless # two algorithms are used: # first is much faster, but only usable if string # doesn't contain any double qoute characters # and backslash sequences are not interpreted # second is more general, but of course slower if .include?("\"") && !interpret_backslash # easy case - no qouting, don't interpres backslash sequences => use splitstring values = .split(/[#{separator}]/) values.each do |v| v = CutBlanks(v) if remove_whitespace == true ret << v if !unique || !ret.include?(v) end else # quoting is used or backslash interpretation is enabled # so it' not possible to split input # parsing each character is needed - use finite automaton # state state = :out_of_string # position in the input string index = 0 # parsed value - buffer str = "" while index < .size character = [index] log.debug "character: #{character} state: #{state} index: #{index}" # interpret backslash sequence if character == "\\" && interpret_backslash nextcharacter = [index + 1] if nextcharacter index += 1 # backslah sequences backslash_seq = { "a" => "\a", # alert "b" => "\b", # backspace "e" => "\e", # escape "f" => "\f", # FF "n" => "\n", # NL "r" => "\r", # CR "t" => "\t", # tab "v" => "\v", # vertical tab "\\" => "\\", # backslash # backslash will be removed later, # double quote and escaped double quote have to be different # as it have different meaning "\"" => "\\\"" } if backslash_seq[nextcharacter] character = backslash_seq[nextcharacter] else # ignore backslash in invalid backslash sequence character = nextcharacter end log.debug "backslash sequence: '#{character}'" else log.warn "Missing character after backslash (\\) at the end of string" end end if state == :out_of_string # ignore separator or white space at the beginning of the string if separator.include?(character) || remove_whitespace && character =~ /[ \t]/ index += 1 next # start of a quoted string elsif character == "\"" state = :in_quoted_string else # start of a string state = :in_string if character == "\\\"" str = "\"" else str = character end end # after double quoted string - handle non-separator chars after double quote elsif state == :in_quoted_string_after_dblqt if separator.include?(character) ret << str if !unique || !Builtins.contains(ret, str) str = "" state = :out_of_string elsif character == "\\\"" str << "\"" else str << character end elsif state == :in_quoted_string if character == "\"" # end of quoted string state = :in_quoted_string_after_dblqt elsif character == "\\\"" str << "\"" else str << character end elsif state == :in_string if separator.include?(character) state = :out_of_string str = CutBlanks(str) if remove_whitespace ret << str if !unique || !ret.include?(str) str = "" elsif character == "\\\"" str << "\"" else str << character end end index += 1 end # error - still in quoted string if state == :in_quoted_string || state == :in_quoted_string_after_dblqt if state == :in_quoted_string log.warn "Missing trainling double quote character(\") in input: '#{}'" end ret << str if !unique || !ret.include?(str) end # process last string in the buffer if state == :in_string str = CutBlanks(str) if remove_whitespace ret << str if !unique || !ret.include?(str) end end log.debug "Parsed values: #{ret}" ret end |
- (Object) Quote(var)
Quote a string with 's
More precisely it protects single quotes inside the string but does not prepend or append single quotes.
59 60 61 62 63 |
# File '../../src/modules/String.rb', line 59 def Quote(var) return "" if var.nil? var.gsub("'", "'\\\\''") end |
- (Object) Random(len)
Make a random base-36 number. srandom should be called beforehand.
698 699 700 701 702 703 704 |
# File '../../src/modules/String.rb', line 698 def Random(len) return "" if !len || len <= 0 digits = DIGIT_CHARS + LOWER_CHARS # uses the character classes from above ret = Array.new(len) { digits[rand(digits.size)] } ret.join("") end |
- (String) RemoveShortcut(label)
Remove a shortcut from a label, so that it can be inserted into help to avoid risk of different translation of the label
762 763 764 765 766 767 768 769 770 771 772 |
# File '../../src/modules/String.rb', line 762 def RemoveShortcut(label) ret = label if Builtins.regexpmatch(label, "^(.*[^&])?(&&)*&[[:alnum:]].*$") ret = Builtins.regexpsub( label, "^((.*[^&])?(&&)*)&([[:alnum:]].*)$", "\\1\\4" ) end ret end |
- (String) Repeat(text, number)
use String#operator* instead
Repeat a string
Repeat a string number of times.
285 286 287 288 289 |
# File '../../src/modules/String.rb', line 285 def Repeat(text, number) return "" if text.nil? || number.nil? || number < 1 text * number end |
- (String) Replace(s, source, target)
Replace substring in a string. All substrings source are replaced by string target.
663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 |
# File '../../src/modules/String.rb', line 663 def Replace(s, source, target) return nil if s.nil? if source.nil? || source == "" Builtins.y2warning("invalid parameter source: %1", source) return s end if target.nil? Builtins.y2warning("invalid parameter target: %1", target) return s end # avoid infinite loop even if it break backward compatibility if target.include?(source) raise "Target #{target} include #{source} which will lead to infinite loop" end pos = s.index(source) while pos tmp = s[0, pos] + target tmp << s[(pos + source.size)..-1] if s.size > (pos + source.size) s = tmp pos = s.index(source) end s end |
- (Object) StartsWith(str, test)
Checks whether string str starts with test.
775 776 777 |
# File '../../src/modules/String.rb', line 775 def StartsWith(str, test) Builtins.search(str, test) == 0 end |
- (Object) SuperPad(text, length, padding, alignment)
Add the padding character around the text to make it long enough
Add the padding character around the text to make it long enough. If the text is longer than requested, no changes are made.
301 302 303 304 305 306 307 308 309 310 311 312 |
# File '../../src/modules/String.rb', line 301 def SuperPad(text, length, padding, alignment) text ||= "" return text if length.nil? || text.size >= length || padding.nil? pad = padding * (length - text.size) if alignment == :right return pad + text else return text + pad end end |
- (String) TextTable(header, items, options)
Function creates text table without using HTML tags. (Useful for commandline) Undefined option uses the default one.
Header: [ “Id”, “Configuration”, “Device” ] Items: [ [ “1”, “aaa”, “Samsung Calex” ], [ “2”, “bbb”, “Trivial Trinitron” ] ] Possible Options: horizontal_padding (for columns), table_left_padding (for table)
614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 |
# File '../../src/modules/String.rb', line 614 def TextTable(header, items, ) ||= {} items ||= [] current_horizontal_padding = ["horizontal_padding"] || 2 current_table_left_padding = ["table_left_padding"] || 4 cols_lenghts = find_longest_records(Builtins.add(items, header)) # whole table is left-padded table_left_padding = Pad("", current_table_left_padding) # the last row has no newline rows_count = items.size table = "" table << table_left_padding table << table_row(header, cols_lenghts, current_horizontal_padding) table << "\n" table << table_left_padding table << table_header_underline(cols_lenghts, current_horizontal_padding) table << "\n" items.each_with_index do |row, rows_counter| table << table_left_padding table << table_row(row, cols_lenghts, current_horizontal_padding) table << "\n" if (rows_counter + 1) < rows_count end table end |
- (String) UnderlinedHeader(header_line, left_padding)
Function returns underlined text header without using HTML tags. (Useful for commandline)
650 651 652 653 654 655 656 |
# File '../../src/modules/String.rb', line 650 def UnderlinedHeader(header_line, left_padding) return nil unless header_line left_padding ||= 0 Pad("", left_padding) + header_line + "\n" + Pad("", left_padding) + underline(header_line.size) end |
- (Object) UnQuote(var)
Unquote a string with 's (quoted with quote)
69 70 71 72 73 74 |
# File '../../src/modules/String.rb', line 69 def UnQuote(var) return "" if var.nil? log.debug "var=#{var}" var.gsub("'\\''", "'") end |
- (String) ValidCharsFilename
Characters valid in a filename (not pathname). Naturally “/” is disallowed. Otherwise, the graphical ASCII characters are allowed.
598 599 600 |
# File '../../src/modules/String.rb', line 598 def ValidCharsFilename GRAPHICAL_CHARS.delete("/") end |
- (Boolean) YesNo(value)
Returns value as “Yes” or “No”
99 100 101 102 |
# File '../../src/modules/String.rb', line 99 def YesNo(value) # TRANSLATORS: human text for Boolean value value ? _("Yes") : _("No") end |