Class: Pakyow::Presenter::Processor

Inherits:
Object
  • Object
show all
Extended by:
Support::ClassState, Support::Makeable
Defined in:
lib/pakyow/presenter/processor.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Processor

Returns a new instance of Processor.



15
16
17
# File 'lib/pakyow/presenter/processor.rb', line 15

def initialize(app)
  @app = app
end

Class Method Details

.extensions(*extensions) ⇒ Object



37
38
39
40
41
42
43
44
# File 'lib/pakyow/presenter/processor.rb', line 37

def extensions(*extensions)
  if extensions.any?
    @extensions ||= []
    @extensions.concat(extensions.map(&:to_sym)).uniq
  else
    @extensions
  end
end

.make(name, *extensions, **kwargs, &block) ⇒ 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.



25
26
27
28
29
30
31
# File 'lib/pakyow/presenter/processor.rb', line 25

def make(name, *extensions, **kwargs, &block)
  # Name is expected to also be an extension.
  #
  extensions.unshift(name).map!(&:to_sym)

  super(name, extensions: extensions, block: block, **kwargs) {}
end

.process(content) ⇒ Object



33
34
35
# File 'lib/pakyow/presenter/processor.rb', line 33

def process(content)
  block.call(content)
end

Instance Method Details

#call(content) ⇒ Object



19
20
21
# File 'lib/pakyow/presenter/processor.rb', line 19

def call(content)
  self.class.process(content)
end