Module: Nio::PercentFmt
- Defined in:
- lib/nio/percent_fmt.rb
Instance Method Summary collapse
Instance Method Details
#nio_read_formatted(txt) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# 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) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# 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 |