Class: TTY::Markdown::Symbols Private
- Inherits:
-
Object
- Object
- TTY::Markdown::Symbols
- Defined in:
- lib/tty/markdown/symbols.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Responsible for storing the symbols configuration
Class Method Summary collapse
-
.from(symbols) ⇒ TTY::Markdown::Symbols
Create a Symbols instance.
Instance Method Summary collapse
-
#[](name) ⇒ String?
Retrieve a symbol by name.
-
#initialize(symbols) ⇒ Symbols
constructor
private
Create a Symbols instance.
-
#wrap_in_brackets(content) ⇒ String
Wrap the content in brackets.
-
#wrap_in_parentheses(content) ⇒ String
Wrap the content in parentheses.
Constructor Details
#initialize(symbols) ⇒ Symbols
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create a TTY::Markdown::Symbols instance
253 254 255 |
# File 'lib/tty/markdown/symbols.rb', line 253 def initialize(symbols) @symbols = symbols end |
Class Method Details
.from(symbols) ⇒ TTY::Markdown::Symbols
Create a TTY::Markdown::Symbols instance
129 130 131 |
# File 'lib/tty/markdown/symbols.rb', line 129 def self.from(symbols) new(validate_names(build_symbols(symbols))) end |
Instance Method Details
#[](name) ⇒ String?
Retrieve a symbol by name
269 270 271 |
# File 'lib/tty/markdown/symbols.rb', line 269 def [](name) @symbols[name.to_sym] end |
#wrap_in_brackets(content) ⇒ String
Wrap the content in brackets
284 285 286 |
# File 'lib/tty/markdown/symbols.rb', line 284 def wrap_in_brackets(content) "#{self[:bracket_left]}#{content}#{self[:bracket_right]}" end |
#wrap_in_parentheses(content) ⇒ String
Wrap the content in parentheses
299 300 301 |
# File 'lib/tty/markdown/symbols.rb', line 299 def wrap_in_parentheses(content) "#{self[:paren_left]}#{content}#{self[:paren_right]}" end |