Module: RBText::Formatting
- Included in:
- F
- Defined in:
- lib/rbtext/formatting.rb
Constant Summary collapse
- @@methods =
[ :reset, :bold, :faint, :italic, :underline, :blinking, :strikethrough ]
Instance Method Summary collapse
- #blinking(mode: :str) ⇒ Object
- #bold(mode: :str) ⇒ Object
- #faint(mode: :str) ⇒ Object
- #italic(mode: :str) ⇒ Object
- #reset(f_opt = nil, mode: :str) ⇒ Object
- #strikethrough(mode: :str) ⇒ Object
- #underline(mode: :str) ⇒ Object
Instance Method Details
#blinking(mode: :str) ⇒ Object
49 50 51 52 53 |
# File 'lib/rbtext/formatting.rb', line 49 def blinking(mode: :str) r="\033[5m" return r if mode == :str print r if mode == :set end |
#bold(mode: :str) ⇒ Object
25 26 27 28 29 |
# File 'lib/rbtext/formatting.rb', line 25 def bold(mode: :str) r="\033[1m" return r if mode == :str print r if mode == :set end |
#faint(mode: :str) ⇒ Object
31 32 33 34 35 |
# File 'lib/rbtext/formatting.rb', line 31 def faint(mode: :str) r="\033[2m" return r if mode == :str print r if mode == :set end |
#italic(mode: :str) ⇒ Object
37 38 39 40 41 |
# File 'lib/rbtext/formatting.rb', line 37 def italic(mode: :str) r="\033[3m" return r if mode == :str print r if mode == :set end |
#reset(f_opt = nil, mode: :str) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rbtext/formatting.rb', line 13 def reset(f_opt = nil, mode: :str) if f_opt r="\033[#{ f_opt =~ /^\033\[(1|2)m$/ ? "\033[22m" : "\033[2#{f_opt.gsub(/[^0-9]/, "")}m" }" else r="\033[0m" end return r if mode == :str print r if mode == :set end |
#strikethrough(mode: :str) ⇒ Object
55 56 57 58 59 |
# File 'lib/rbtext/formatting.rb', line 55 def strikethrough(mode: :str) r="\033[9m" return r if mode == :str print r if mode == :set end |
#underline(mode: :str) ⇒ Object
43 44 45 46 47 |
# File 'lib/rbtext/formatting.rb', line 43 def underline(mode: :str) r="\033[4m" return r if mode == :str print r if mode == :set end |