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 def to_html
[ [
setup.prologue,
@annotation&.to_html, @annotation&.to_html,
@chapter&.to_html, @chapter&.to_html,
setup.epilogue, setup.epilogue,
@ -30,7 +29,6 @@ module Repubmark
def to_gemtext def to_gemtext
[ [
setup.prologue,
@annotation&.to_gemtext, @annotation&.to_gemtext,
@chapter&.to_gemtext, @chapter&.to_gemtext,
setup.epilogue, setup.epilogue,

View file

@ -8,35 +8,12 @@ module Repubmark
freeze freeze
end end
attr_reader :prologue, :epilogue attr_reader :epilogue
def prologue=(prologue)
prologue = String(prologue).strip.freeze
prologue = nil if prologue.empty?
@prologue = prologue
end
def epilogue=(epilogue) def epilogue=(epilogue)
epilogue = String(epilogue).strip.freeze epilogue = String(epilogue).strip.freeze
epilogue = nil if epilogue.empty? epilogue = nil if epilogue.empty?
@epilogue = epilogue @epilogue = epilogue
end 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
end end