Class: Metanorma::Cli::Collection

Inherits:
Object
  • Object
show all
Defined in:
lib/metanorma/cli/collection.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, options) ⇒ Collection

Returns a new instance of Collection.



8
9
10
11
12
13
# File 'lib/metanorma/cli/collection.rb', line 8

def initialize(file, options)
  @file = file
  @options = Cli.with_indifferent_access(options)
  @output_dir = @options.delete(:output_dir)
  @compile_options = @options.delete(:compile)
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



6
7
8
# File 'lib/metanorma/cli/collection.rb', line 6

def file
  @file
end

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/metanorma/cli/collection.rb', line 6

def options
  @options
end

Class Method Details

.render(filename, options = {}) ⇒ Object



15
16
17
# File 'lib/metanorma/cli/collection.rb', line 15

def self.render(filename, options = {})
  new(filename, options).render
end

Instance Method Details

#collection_fileObject



25
26
27
# File 'lib/metanorma/cli/collection.rb', line 25

def collection_file
  @collection_file ||= Metanorma::Collection.parse(file)
end

#renderObject



19
20
21
22
23
# File 'lib/metanorma/cli/collection.rb', line 19

def render
  extract_options_from_file
  collection_file.render(collection_options.compact)
  self
end