class Polites::Sheet
A sheet is represents a single “document” in Polites
. It composes the main content in {Sheet#content}, its markup definition in {Sheet#markup}, any attaches files in {Sheet#files} and some metadata.
Attributes
app_version[R]
@return [String]
content[R]
@return [Array<Node>]
files[R]
@return [Array<String>]
keywords[R]
@return [Array<String>]
markup[R]
@return [Markup]
notes[R]
@return [Array<Array<Node>>]
version[R]
@return [String]
Public Class Methods
new(version:, app_version:, markup:, content:, keywords: [], files: [], notes: [])
click to toggle source
@param [String] version @param [String] app_version
@param [Markup] markup @param [Array<Node>] content @param [Array<String>] keywords @param [Array<String>] files @param [Array<Array<Node>>] notes
# File lib/polites/sheet.rb, line 36 def initialize(version:, app_version:, markup:, content:, keywords: [], files: [], notes: []) @version = version @app_version = app_version @markup = markup @content = content @keywords = keywords @files = files @notes = notes end
Public Instance Methods
attached_files()
click to toggle source
Get all files that were attached to the sheet without explicit mention in the content.
@return [Array<String>]
# File lib/polites/sheet.rb, line 59 def attached_files files - inline_files.map(&:image) end
inline_files()
click to toggle source
Get all files that were referenced in the content, such as inline images.
@return [Array<Span::Image>]
# File lib/polites/sheet.rb, line 49 def inline_files content.flat_map do |node| node.children.grep(Span::Image) end end