Class: Amrita2::Filters::AcceptData

Inherits:
Base show all
Includes:
Renderers
Defined in:
lib/amrita2/template.rb

Instance Attribute Summary

Attributes inherited from Base

#next_

Instance Method Summary collapse

Methods inherited from Base

filter_method, inherited, #parse_filter_a, #|

Constructor Details

#initialize(*types) ⇒ AcceptData

Returns a new instance of AcceptData.



2158
2159
2160
# File 'lib/amrita2/template.rb', line 2158

def initialize(*types)
  @types = types
end

Instance Method Details

#setup_type_renderer(de) ⇒ Object



2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
# File 'lib/amrita2/template.rb', line 2162

def setup_type_renderer(de)
  nil_processed = true_processed = hook_processed = false
  @types.each do |t|
    case t
    when nil, NilClass
      de.renderers.unshift NilRenderer.new unless nil_processed
      nil_processed = true
    when true, TrueClass
      de.renderers << TrueRenderer.new unless true_processed
      true_processed = true
    when :hook
      de.renderers << Core::Hook::Renderer.new unless hook_processed
      hook_processed = true
    else
      raise ArgumentError,"unknown type for AcceptData #{t.inspect}"
    end
  end
  super
end