Class: Object

Inherits:
BasicObject
Defined in:
lib/sup_tag/extensions/Object.rb

Overview

Modify Object to support tag and archive methods.

Instance Method Summary collapse

Instance Method Details

#archive(&block) ⇒ Set

Archive messages using the given block.

Parameters:

  • A (Block)

    block to use to tag.

Returns:

  • (Set)

    The Set of tags on the message.



19
20
21
22
# File 'lib/sup_tag/extensions/Object.rb', line 19

def archive(&block)
  tagger = get_tagger(&block)
  tagger.archive(&block)
end

#get_tagger(&block) ⇒ SupTag

Get the SupTag object for the given block.

Parameters:

  • A (Block)

    Block to generate the tagger object with.

Returns:

  • (SupTag)

    A SupTag object.



28
29
30
# File 'lib/sup_tag/extensions/Object.rb', line 28

def get_tagger(&block)
  return SupTag.new(block.binding[:message])
end

#tag(&block) ⇒ Set

Tag messages using the given block.

Parameters:

  • block (Block)

    Block to tag with.

Returns:

  • (Set)

    The Set of tags on the message.



10
11
12
13
# File 'lib/sup_tag/extensions/Object.rb', line 10

def tag(&block)
  tagger = get_tagger(&block)
  tagger.tag(&block)
end