repubmark/lib/repubmark/elems/paragraph.rb

41 lines
854 B
Ruby

# frozen_string_literal: true
module Repubmark
module Elems
class Paragraph < Base
parents :Canvas
def initialize(parent)
super parent
@caption = Caption.new self
end
#################
# Basic methods #
#################
def word_count = @caption.word_count
def to_html = "<p>\n#{@caption.to_html}</p>\n".freeze
def to_gemtext = "#{@caption.to_gemtext}\n".freeze
###################
# Builder methods #
###################
def respond_to_missing?(method_name, _include_private)
@caption.respond_to?(method_name) || super
end
def method_missing(method_name, ...)
if @caption.respond_to?(method_name)
@caption.public_send(method_name, ...)
else
super
end
end
end
end
end