Remove attrs Repubmark::Setup#locale, #prologue

This commit is contained in:
Alex Kotov 2024-02-24 06:26:54 +04:00
parent 093d6938c8
commit 1a233ac6aa
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
2 changed files with 1 additions and 26 deletions

View File

@ -21,7 +21,6 @@ module Repubmark
def to_html
[
setup.prologue,
@annotation&.to_html,
@chapter&.to_html,
setup.epilogue,
@ -30,7 +29,6 @@ module Repubmark
def to_gemtext
[
setup.prologue,
@annotation&.to_gemtext,
@chapter&.to_gemtext,
setup.epilogue,

View File

@ -8,35 +8,12 @@ module Repubmark
freeze
end
attr_reader :prologue, :epilogue
def prologue=(prologue)
prologue = String(prologue).strip.freeze
prologue = nil if prologue.empty?
@prologue = prologue
end
attr_reader :epilogue
def epilogue=(epilogue)
epilogue = String(epilogue).strip.freeze
epilogue = nil if epilogue.empty?
@epilogue = epilogue
end
##########
# Locale #
##########
LOCALE_RE = /\A[a-z]{2,3}\z/
DEFAULT_LOCALE = :en
def locale = @locale || DEFAULT_LOCALE
def locale=(locale)
locale = String(locale).to_sym
raise 'Invalid locale' unless LOCALE_RE.match? locale
raise 'Locale has already been set' if @locale
@locale = locale
end
end
end