Module: Pubid::Rendering::Base
- Defined in:
- lib/pubid/rendering/base.rb
Instance Method Summary collapse
-
#render_base(**options) ⇒ String
Base rendering method to be composed by subclasses.
Methods included from Format
Methods included from Language
Methods included from Stage
Methods included from Supplement
Methods included from Date
Methods included from Numbering
Methods included from Publisher
Instance Method Details
#render_base(**options) ⇒ String
Base rendering method to be composed by subclasses
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/pubid/rendering/base.rb', line 25 def render_base(**) parts = [] # Publisher/copublisher pub = maybe(:publisher) if pub parts << render_publisher(pub, maybe(:copublishers), **) end # Numbering (number, part, subpart) num = maybe(:number) if num parts << render_numbering(num, maybe(:part), maybe(:subpart), **) end # Date d = maybe(:date) if d parts << render_date(d, **) end # Stage and type stg = maybe(:stage) if stg parts << render_stage(stg, maybe(:type), has_copublisher: maybe(:copublishers)&.any?, **) end # Language codes langs = maybe(:languages) if langs&.any? parts << render_languages(langs, **) end parts.compact.join end |