Class: Repubmark::Elems::CodeInline
- Defined in:
- lib/repubmark/elems/code_inline.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(parent, str) ⇒ CodeInline
constructor
A new instance of CodeInline.
- #str=(str) ⇒ Object private
- #to_gemtext ⇒ Object
- #to_html ⇒ Object
-
#to_summary_plain ⇒ Object
Basic methods #.
Methods inherited from Base
#absolute_url, #config, #count_words, #html_class, #own_url, parent?, parents, #relative_url, #word_count
Constructor Details
#initialize(parent, str) ⇒ CodeInline
Returns a new instance of CodeInline.
8 9 10 11 |
# File 'lib/repubmark/elems/code_inline.rb', line 8 def initialize(parent, str) super parent self.str = str end |
Instance Method Details
#str=(str) ⇒ Object (private)
25 26 27 28 29 30 31 32 |
# File 'lib/repubmark/elems/code_inline.rb', line 25 def str=(str) str = String(str).freeze if str.include?("\n") || str.include?('«') || str.include?('»') raise 'Invalid str' end @str = str end |
#to_gemtext ⇒ Object
21 |
# File 'lib/repubmark/elems/code_inline.rb', line 21 def to_gemtext = "«#{@str}»".freeze |
#to_html ⇒ Object
19 |
# File 'lib/repubmark/elems/code_inline.rb', line 19 def to_html = "<code>#{CGI.escape_html(@str)}</code>".freeze |
#to_summary_plain ⇒ Object
Basic methods #
17 |
# File 'lib/repubmark/elems/code_inline.rb', line 17 def to_summary_plain = "«#{@str}»".freeze |