class AaaaAaaa::Text
Public Class Methods
new(str, step=nil, prefix="", production: false)
click to toggle source
# File lib/aaaa_aaaa.rb, line 8 def initialize(str, step=nil, prefix="", production: false) @value = "" @str = str @step = step @prefix = prefix @production = production if @step @nextstep = step end end
Public Instance Methods
*(mul)
click to toggle source
# File lib/aaaa_aaaa.rb, line 48 def *(mul) if @step @iter = mul / @step @iter.times do |x| @value += line end @value += @str * (mul % @step) else @value = @str * (mul / @str.length) end self end
line()
click to toggle source
# File lib/aaaa_aaaa.rb, line 41 def line step_length = @nextstep.to_s.length - 1 line_str = prefix_str + (@str * ((@step - (step_length + 1) - (prefix_length)) / @str.length)) + zenkaku_step @nextstep += @step return line_str end
prefix_length()
click to toggle source
# File lib/aaaa_aaaa.rb, line 33 def prefix_length @prefix ? @prefix.length : 0 end
prefix_str()
click to toggle source
# File lib/aaaa_aaaa.rb, line 37 def prefix_str @prefix || "" end
to_s()
click to toggle source
# File lib/aaaa_aaaa.rb, line 61 def to_s if @production raise NotUseAaaaAaaaError, "set procution mode. you must remove AaaaAaaa." else @value end end
zenkaku_step()
click to toggle source
# File lib/aaaa_aaaa.rb, line 20 def zenkaku_step _use_str = @nextstep.to_s hankaku_to_zenkaku = [["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"], ["9", "9"]] hankaku_to_zenkaku.each do |from, to| _use_str.gsub! from, to end _use_str end