Class: ReplacementTags
- Inherits:
-
Object
- Object
- ReplacementTags
- Defined in:
- lib/flickrup/ext/replacement_tags.rb
Instance Method Summary collapse
-
#initialize(config) ⇒ ReplacementTags
constructor
A new instance of ReplacementTags.
- #preupload(ctx) ⇒ Object
Constructor Details
#initialize(config) ⇒ ReplacementTags
Returns a new instance of ReplacementTags.
2 3 4 |
# File 'lib/flickrup/ext/replacement_tags.rb', line 2 def initialize(config) @config = config end |
Instance Method Details
#preupload(ctx) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/flickrup/ext/replacement_tags.rb', line 6 def preupload(ctx) replacements = @config[:tag_replacements] = ctx.file. if replacements != nil replacements.each do |tag_name, tag_value_replacements| existing = ctx.file[tag_name] tag_value_replacements.each do |key, value| if key.start_with? '$' if .include? key[1..-1] ctx.file[tag_name] = value break end else if existing == key ctx.file[tag_name] = value break end end end end end ctx end |