Class: Defmastership::BatchModifier
- Inherits:
-
Object
- Object
- Defmastership::BatchModifier
- Defined in:
- lib/defmastership/batch_modifier.rb
Overview
Apply modications on a list of related asciidoc sources
Instance Attribute Summary collapse
-
#adoc_sources ⇒ Hash{String => String}
readonly
Stores the list of asciidoc files to modify and to save.
-
#changes ⇒ Array<Array<String>>
readonly
Provides the list of performed modifications (each line: [Modifier, Was, Becomes]).
-
#config ⇒ YAML
readonly
Stores the overall invocation configuration.
Instance Method Summary collapse
-
#apply(modifs) ⇒ Object
Apply modications on asciidoc sources of @adoc_sources.
-
#initialize(config, adoc_sources) ⇒ BatchModifier
constructor
A new instance of BatchModifier.
Constructor Details
#initialize(config, adoc_sources) ⇒ BatchModifier
Returns a new instance of BatchModifier.
26 27 28 29 30 |
# File 'lib/defmastership/batch_modifier.rb', line 26 def initialize(config, adoc_sources) @config = config @adoc_sources = adoc_sources @changes = [] end |
Instance Attribute Details
#adoc_sources ⇒ Hash{String => String} (readonly)
Stores the list of asciidoc files to modify and to save
16 17 18 |
# File 'lib/defmastership/batch_modifier.rb', line 16 def adoc_sources @adoc_sources end |
#changes ⇒ Array<Array<String>> (readonly)
Provides the list of performed modifications (each line: [Modifier, Was, Becomes])
20 21 22 |
# File 'lib/defmastership/batch_modifier.rb', line 20 def changes @changes end |
#config ⇒ YAML (readonly)
Stores the overall invocation configuration
11 12 13 |
# File 'lib/defmastership/batch_modifier.rb', line 11 def config @config end |
Instance Method Details
#apply(modifs) ⇒ Object
Apply modications on asciidoc sources of @adoc_sources
35 36 37 38 39 40 41 42 43 |
# File 'lib/defmastership/batch_modifier.rb', line 35 def apply(modifs) modifs.each do |modif| modifier = modifier_from(modif) @adoc_sources = modifier.do_modifications(adoc_sources) config.fetch(modif)[:config] = modifier.config collect_changes(modifier, modif) end end |