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.
24 25 26 27 28 |
# File 'lib/defmastership/batch_modifier.rb', line 24 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
14 15 16 |
# File 'lib/defmastership/batch_modifier.rb', line 14 def adoc_sources @adoc_sources end |
#changes ⇒ Array<Array<String>> (readonly)
Provides the list of performed modifications (each line: [Modifier, Was, Becomes])
18 19 20 |
# File 'lib/defmastership/batch_modifier.rb', line 18 def changes @changes end |
#config ⇒ YAML (readonly)
Stores the overall invocation configuration
9 10 11 |
# File 'lib/defmastership/batch_modifier.rb', line 9 def config @config end |
Instance Method Details
#apply(modifs) ⇒ Object
Apply modications on asciidoc sources of @adoc_sources
33 34 35 36 37 38 39 40 41 |
# File 'lib/defmastership/batch_modifier.rb', line 33 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 |