Class: Transfigr::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/transfigr/abstract_formatter.rb

Overview

Transfigr::Formatter is the base class to inherit from when developing your own formatters

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target) ⇒ Formatter

Returns a new instance of Formatter.


6
7
8
# File 'lib/transfigr/abstract_formatter.rb', line 6

def initialize(target)
  @target = target
end

Instance Attribute Details

#targetObject

Returns the value of attribute target


4
5
6
# File 'lib/transfigr/abstract_formatter.rb', line 4

def target
  @target
end

Class Method Details

.after_activation(&block) ⇒ Object

The after_activation block allows you to call code after the formatter has been activated. This includes requireing any dependencies

Example

class MyFoo < Transfigr::Formatter
  # snip
  after_activation{ require "foo" }
  #snip
end

:api: plugin


22
23
24
25
# File 'lib/transfigr/abstract_formatter.rb', line 22

def self.after_activation(&block)
  @after_activation = block if block_given?
  @after_activation
end