Module: IIRC::Formatting
- Included in:
- Batteries
- Defined in:
- lib/iirc/modules/formatting.rb
Class Method Summary collapse
- .bold(s) ⇒ Object
- .italic(s) ⇒ Object
- .strike(s) ⇒ Object
- .strip(s) ⇒ Object (also: strip_formatting)
- .underline(s) ⇒ Object
Instance Method Summary collapse
- #bold(s) ⇒ Object private
- #italic(s) ⇒ Object private
- #strike(s) ⇒ Object private
- #strip(s) ⇒ Object private
- #strip_formatting ⇒ Object private
- #underline(s) ⇒ Object private
Class Method Details
.bold(s) ⇒ Object
4 |
# File 'lib/iirc/modules/formatting.rb', line 4 def bold(s) "\x02#{s}\x02" end |
.italic(s) ⇒ Object
5 |
# File 'lib/iirc/modules/formatting.rb', line 5 def italic(s) "\x1d#{s}\x1d" end |
.strike(s) ⇒ Object
6 |
# File 'lib/iirc/modules/formatting.rb', line 6 def strike(s) "\x1e#{s}\x1e" end |
.strip(s) ⇒ Object Also known as: strip_formatting
8 |
# File 'lib/iirc/modules/formatting.rb', line 8 def strip(s) s.gsub(/\x03(?:\d{1,2}(?:,\d{1,2})?)?/, '') end |
.underline(s) ⇒ Object
7 |
# File 'lib/iirc/modules/formatting.rb', line 7 def underline(s) "\x1f#{s}\x1f" end |
Instance Method Details
#bold(s) ⇒ Object (private)
4 |
# File 'lib/iirc/modules/formatting.rb', line 4 def bold(s) "\x02#{s}\x02" end |
#italic(s) ⇒ Object (private)
5 |
# File 'lib/iirc/modules/formatting.rb', line 5 def italic(s) "\x1d#{s}\x1d" end |
#strike(s) ⇒ Object (private)
6 |
# File 'lib/iirc/modules/formatting.rb', line 6 def strike(s) "\x1e#{s}\x1e" end |
#strip(s) ⇒ Object (private)
8 |
# File 'lib/iirc/modules/formatting.rb', line 8 def strip(s) s.gsub(/\x03(?:\d{1,2}(?:,\d{1,2})?)?/, '') end |
#strip_formatting ⇒ Object (private)
9 |
# File 'lib/iirc/modules/formatting.rb', line 9 alias :strip_formatting :strip |
#underline(s) ⇒ Object (private)
7 |
# File 'lib/iirc/modules/formatting.rb', line 7 def underline(s) "\x1f#{s}\x1f" end |