Module: IpynbDiff::SymbolizedMarkdownHelper
- Included in:
- OutputTransformer, Transformer
- Defined in:
- lib/symbolized_markdown_helper.rb
Overview
Helper functions
Instance Method Summary collapse
- #_(symbol = nil, content = '') ⇒ Object
- #array_if_not_array(thing) ⇒ Object
- #symbolize_array(symbol, content, &block) ⇒ Object
Instance Method Details
#_(symbol = nil, content = '') ⇒ Object
7 8 9 |
# File 'lib/symbolized_markdown_helper.rb', line 7 def _(symbol = nil, content = '') { symbol: symbol, content: content } end |
#array_if_not_array(thing) ⇒ Object
11 12 13 |
# File 'lib/symbolized_markdown_helper.rb', line 11 def array_if_not_array(thing) thing.is_a?(Array) ? thing : [thing] end |
#symbolize_array(symbol, content, &block) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/symbolized_markdown_helper.rb', line 15 def symbolize_array(symbol, content, &block) if content.is_a?(Array) content.map.with_index { |l, idx| _(symbol / idx, block.call(l)) } else _(symbol, content) end end |