Class: Pakyow::Presenter::ProcessorCaller Private

Inherits:
Object
  • Object
show all
Defined in:
lib/pakyow/presenter/processor.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initialize(instances) ⇒ ProcessorCaller

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ProcessorCaller.



50
51
52
# File 'lib/pakyow/presenter/processor.rb', line 50

def initialize(instances)
  @processors = normalize(instances)
end

Instance Method Details

#process(content, extension) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/pakyow/presenter/processor.rb', line 54

def process(content, extension)
  content = content.to_s

  processors_for_extension(extension).each do |processor|
    content = processor.call(content)
  end

  unless extension == :html
    processors_for_extension(:html).each do |processor|
      content = processor.call(content)
    end
  end

  content
end

#process?(extension) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


70
71
72
# File 'lib/pakyow/presenter/processor.rb', line 70

def process?(extension)
  @processors.key?(extension.tr(".", "").to_sym)
end