Sha256: cb6d71e64fe22fd4c2f8942eaed616e22efeeb41a527b5b7b1e479a812545bed
Contents?: true
Size: 655 Bytes
Versions: 42
Compression:
Stored size: 655 Bytes
Contents
# encoding: utf-8 class MarkdownString # Return markdown italic from text # # === Example # # case list # # MarkdownString.italic(%w{a b c}) # # resitalict # # * a # * b # * c # # case not list # # MarkdownString.italic("test") # => "test" # # case nil list # # MarkdownString.italic([nil, nil]) # # resitalict # # * # * # # case empty list # # MarkdownString.italic([]) # => "" # def self.italic(text) return '**' if text.nil? return text unless text.is_a?(String) return '**' if text.empty? "*#{text}*" end end
Version data entries
42 entries across 42 versions & 1 rubygems