Class: FileComposer::Blueprint

Inherits:
Object
  • Object
show all
Defined in:
lib/file_composer/blueprint.rb

Overview

The main object model.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(documents: []) ⇒ Blueprint

Returns a new instance of Blueprint.

Raises:

  • (ArgumentError)


20
21
22
23
24
25
26
# File 'lib/file_composer/blueprint.rb', line 20

def initialize(documents: [])
  @documents = Documents.array(documents)
  filenames  = @documents.map { |a| a.filename.downcase }
  not_unique = filenames.uniq.length != @documents.length

  raise ArgumentError, "filenames not unique: #{filenames}" if not_unique
end

Instance Attribute Details

#documentsObject (readonly)

Returns the value of attribute documents.



18
19
20
# File 'lib/file_composer/blueprint.rb', line 18

def documents
  @documents
end

Instance Method Details

#write!(temp_root = '', store = Stores::Null.new) ⇒ Object



28
29
30
# File 'lib/file_composer/blueprint.rb', line 28

def write!(temp_root = '', store = Stores::Null.new)
  documents.flat_map { |d| d.write!(temp_root, store) }
end