Class: Polites::Sheet
- Inherits:
-
Object
- Object
- Polites::Sheet
- Defined in:
- lib/polites/sheet.rb
Overview
Instance Attribute Summary collapse
- #app_version ⇒ String readonly
- #content ⇒ Array<Node> readonly
- #files ⇒ Array<String> readonly
- #keywords ⇒ Array<String> readonly
- #markup ⇒ Markup readonly
- #notes ⇒ Array<Array<Node>> readonly
- #version ⇒ String readonly
Instance Method Summary collapse
-
#attached_files ⇒ Array<String>
Get all files that were attached to the sheet without explicit mention in the content.
-
#initialize(version:, app_version:, markup:, content:, keywords: [], files: [], notes: []) ⇒ Sheet
constructor
A new instance of Sheet.
-
#inline_files ⇒ Array<Span::Image>
Get all files that were referenced in the content, such as inline images.
Constructor Details
#initialize(version:, app_version:, markup:, content:, keywords: [], files: [], notes: []) ⇒ Sheet
Returns a new instance of Sheet.
36 37 38 39 40 41 42 43 44 |
# 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 |
Instance Attribute Details
#app_version ⇒ String (readonly)
12 13 14 |
# File 'lib/polites/sheet.rb', line 12 def app_version @app_version end |
#content ⇒ Array<Node> (readonly)
18 19 20 |
# File 'lib/polites/sheet.rb', line 18 def content @content end |
#files ⇒ Array<String> (readonly)
24 25 26 |
# File 'lib/polites/sheet.rb', line 24 def files @files end |
#keywords ⇒ Array<String> (readonly)
21 22 23 |
# File 'lib/polites/sheet.rb', line 21 def keywords @keywords end |
#notes ⇒ Array<Array<Node>> (readonly)
27 28 29 |
# File 'lib/polites/sheet.rb', line 27 def notes @notes end |
#version ⇒ String (readonly)
9 10 11 |
# File 'lib/polites/sheet.rb', line 9 def version @version end |
Instance Method Details
#attached_files ⇒ Array<String>
Get all files that were attached to the sheet without explicit mention in the content.
59 60 61 |
# File 'lib/polites/sheet.rb', line 59 def attached_files files - inline_files.map(&:image) end |
#inline_files ⇒ Array<Span::Image>
Get all files that were referenced in the content, such as inline images.
49 50 51 52 53 |
# File 'lib/polites/sheet.rb', line 49 def inline_files content.flat_map do |node| node.children.grep(Span::Image) end end |