Class: Fabulator::TagLib::Transformations

Inherits:
Object
  • Object
show all
Defined in:
lib/fabulator/tag_lib/transformations.rb

Instance Method Summary collapse

Constructor Details

#initializeTransformations

Returns a new instance of Transformations.



8
9
10
# File 'lib/fabulator/tag_lib/transformations.rb', line 8

def initialize
  @formats = { }
end

Instance Method Details

#get_root_namespaces(fmt) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/fabulator/tag_lib/transformations.rb', line 25

def get_root_namespaces(fmt)
  if !@formats[fmt.to_sym].nil?
    @formats[fmt.to_sym].get_root_namespaces
  else
    []
  end
end

#html(&block) ⇒ Object



12
13
14
15
# File 'lib/fabulator/tag_lib/transformations.rb', line 12

def html(&block)
  @formats[:html] ||= Fabulator::TagLib::Format.new
  @formats[:html].instance_eval &block
end

#transform(fmt, doc, opts = { }) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/fabulator/tag_lib/transformations.rb', line 17

def transform(fmt, doc, opts = { })
  if !@formats[fmt.to_sym].nil?
    @formats[fmt.to_sym].transform(doc, opts)
  else
    doc
  end
end