Module: Brief::Document::Attachments

Included in:
Brief::Document
Defined in:
lib/brief/document/attachments.rb

Instance Method Summary collapse

Instance Method Details

#attachmentsObject



8
9
10
# File 'lib/brief/document/attachments.rb', line 8

def attachments
  Array(data.attachments)
end

#has_attachments?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/brief/document/attachments.rb', line 4

def has_attachments?
  attachments.length > 0
end

#render_attachmentsObject



12
13
14
15
16
17
18
19
# File 'lib/brief/document/attachments.rb', line 12

def render_attachments
  attachments.reduce({}.to_mash) do |memo, name|
    if asset = briefcase.find_asset(name)
      memo[asset.basename] = asset.read
      memo
    end
  end
end