Class: DefMastership::BatchModifier
- Inherits:
-
Object
- Object
- DefMastership::BatchModifier
- Defined in:
- lib/defmastership/batch_modifier.rb
Overview
Change references from temporary to definitive with multiple RefChangers
Instance Attribute Summary collapse
-
#adoc_texts ⇒ Object
readonly
Returns the value of attribute adoc_texts.
-
#changes ⇒ Object
readonly
Returns the value of attribute changes.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #apply(modifs) ⇒ Object
-
#initialize(config, adoc_texts) ⇒ BatchModifier
constructor
A new instance of BatchModifier.
Constructor Details
#initialize(config, adoc_texts) ⇒ BatchModifier
Returns a new instance of BatchModifier.
9 10 11 12 13 |
# File 'lib/defmastership/batch_modifier.rb', line 9 def initialize(config, adoc_texts) @config = config @adoc_texts = adoc_texts @changes = [] end |
Instance Attribute Details
#adoc_texts ⇒ Object (readonly)
Returns the value of attribute adoc_texts.
7 8 9 |
# File 'lib/defmastership/batch_modifier.rb', line 7 def adoc_texts @adoc_texts end |
#changes ⇒ Object (readonly)
Returns the value of attribute changes.
7 8 9 |
# File 'lib/defmastership/batch_modifier.rb', line 7 def changes @changes end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
7 8 9 |
# File 'lib/defmastership/batch_modifier.rb', line 7 def config @config end |
Instance Method Details
#apply(modifs) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/defmastership/batch_modifier.rb', line 15 def apply(modifs) modifs.split(/\s*,\s*/).each do |modif| modifier = modifier_from(modif) @adoc_texts = modifier.do_modifications(@adoc_texts) @config[modif.to_sym][:config] = modifier.config modifier.changes.each do |change| @changes << [modif] + change end end end |