Class: String
Overview
mixin => String
Instance Method Summary collapse
-
#invalid_letters? ⇒ Boolean
returns the number of letters that can’t be converted to ITA2 or false if every letter can be converted.
-
#to_ita2 ⇒ Object
returns an array of letters converted to ITA2 codes.
-
#to_punchcode(on = "#", off = "\s") ⇒ Object
returns a string showing the ITA2 codes in a 5bit punchcode ASCII graphic.
Instance Method Details
#invalid_letters? ⇒ Boolean
returns the number of letters that can’t be converted to ITA2 or false if every letter can be converted
94 95 96 97 98 99 100 101 |
# File 'lib/ita2.rb', line 94 def invalid_letters? invalid = 0 self.downcase.each_char do |char| invalid += 1 unless FIGS.include?(char) or LTRS.include?(char) end return invalid if invalid > 0 false end |
#to_ita2 ⇒ Object
returns an array of letters converted to ITA2 codes
84 85 86 |
# File 'lib/ita2.rb', line 84 def to_ita2 codes(self) end |
#to_punchcode(on = "#", off = "\s") ⇒ Object
returns a string showing the ITA2 codes in a 5bit punchcode ASCII graphic
89 90 91 |
# File 'lib/ita2.rb', line 89 def to_punchcode(on = "#", off = "\s") pretty_string(self, on, off) end |