Class: BlockedTags

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/flickrup/ext/blocked_tags.rb

Instance Method Summary collapse

Methods included from Logging

logger, #logger, pre_init

Constructor Details

#initialize(config) ⇒ BlockedTags

Returns a new instance of BlockedTags.



4
5
6
# File 'lib/flickrup/ext/blocked_tags.rb', line 4

def initialize(config)
  @config = config
end

Instance Method Details

#preupload(ctx) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/flickrup/ext/blocked_tags.rb', line 8

def preupload(ctx)

  blockers = @config[:blocked_tags]

  if blockers != nil
    blockers.each do |tag_name, tag_value|
      if ctx.file[tag_name] == tag_value
        #block
        logger.info("Blocking upload on #{ctx.properties[:filename]} as #{tag_name}=#{tag_value}")
        return nil
      end
    end
  end

  ctx
end