Class: Repubmark::Elems::Annotation
- Defined in:
- lib/repubmark/elems/annotation.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(parent) ⇒ Annotation
constructor
A new instance of Annotation.
- #method_missing(method_name) ⇒ Object
-
#respond_to_missing?(method_name, _include_private) ⇒ Boolean
Builder methods #.
- #to_gemtext ⇒ Object
- #to_html ⇒ Object
- #to_summary_plain ⇒ Object
-
#word_count ⇒ Object
Basic methods #.
Methods inherited from Base
#absolute_url, #config, #count_words, #html_class, #own_url, parent?, parents, #relative_url
Constructor Details
#initialize(parent) ⇒ Annotation
Returns a new instance of Annotation.
8 9 10 11 |
# File 'lib/repubmark/elems/annotation.rb', line 8 def initialize(parent) super parent @canvas = Canvas.new self end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/repubmark/elems/annotation.rb', line 39 def method_missing(method_name, ...) if @canvas.respond_to? method_name @canvas.public_send(method_name, ...) else super end end |
Instance Method Details
#respond_to_missing?(method_name, _include_private) ⇒ Boolean
Builder methods #
35 36 37 |
# File 'lib/repubmark/elems/annotation.rb', line 35 def respond_to_missing?(method_name, _include_private) @canvas.respond_to?(method_name) || super end |
#to_gemtext ⇒ Object
29 |
# File 'lib/repubmark/elems/annotation.rb', line 29 def to_gemtext = @canvas.to_gemtext |
#to_html ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/repubmark/elems/annotation.rb', line 21 def to_html [ %(<div#{html_class(:annotation)}>\n), @canvas.to_html, "</div>\n", ].join.freeze end |
#to_summary_plain ⇒ Object
19 |
# File 'lib/repubmark/elems/annotation.rb', line 19 def to_summary_plain = @canvas.to_summary_plain |
#word_count ⇒ Object
Basic methods #
17 |
# File 'lib/repubmark/elems/annotation.rb', line 17 def word_count = @canvas.word_count |