module Nio::PercentFmt

Public Instance Methods

nio_read_formatted(txt) click to toggle source
Calls superclass method
# File lib/nio/percent_fmt.rb, line 28
def nio_read_formatted(txt)
  if txt =~ /%\z/
    txt = txt[0..-2]
    neutral = super(txt)
    neutral.dec_pos += (@percent_digits || -2)
    neutral
  else
    super
  end
end
nio_write_formatted(neutral) click to toggle source
Calls superclass method
# File lib/nio/percent_fmt.rb, line 18
def nio_write_formatted(neutral)
  if @percent
    neutral = neutral.dup
    neutral.dec_pos -= (@percent_digits || -2)
    super + "%"
  else
    super
  end
end