Class: Repubmark::Elems::Paragraph

Inherits:
Base
  • Object
show all
Defined in:
lib/repubmark/elems/paragraph.rb

Instance Attribute Summary

Attributes inherited from Base

#parent

Instance Method Summary collapse

Methods inherited from Base

#absolute_url, #config, #count_words, #html_class, #own_url, parent?, parents, #relative_url

Constructor Details

#initialize(parent) ⇒ Paragraph

Returns a new instance of Paragraph.



8
9
10
11
# File 'lib/repubmark/elems/paragraph.rb', line 8

def initialize(parent)
  super parent
  @caption = Caption.new self
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/repubmark/elems/paragraph.rb', line 33

def method_missing(method_name, ...)
  if @caption.respond_to?(method_name)
    @caption.public_send(method_name, ...)
  else
    super
  end
end

Instance Method Details

#respond_to_missing?(method_name, _include_private) ⇒ Boolean

Builder methods #

Returns:

  • (Boolean)


29
30
31
# File 'lib/repubmark/elems/paragraph.rb', line 29

def respond_to_missing?(method_name, _include_private)
  @caption.respond_to?(method_name) || super
end

#to_gemtextObject



23
# File 'lib/repubmark/elems/paragraph.rb', line 23

def to_gemtext = "#{@caption.to_gemtext}\n".freeze

#to_htmlObject



21
# File 'lib/repubmark/elems/paragraph.rb', line 21

def to_html = "<p>\n#{@caption.to_html}</p>\n".freeze

#to_summary_plainObject



19
# File 'lib/repubmark/elems/paragraph.rb', line 19

def to_summary_plain = @caption.to_summary_plain

#word_countObject

Basic methods #



17
# File 'lib/repubmark/elems/paragraph.rb', line 17

def word_count = @caption.word_count