Module: Roda::RodaPlugins::CustomBlockResults::ClassMethods

Defined in:
lib/roda/plugins/custom_block_results.rb

Instance Method Summary collapse

Instance Method Details

#freezeObject

Freeze the configured custom block results when freezing the app.



39
40
41
42
# File 'lib/roda/plugins/custom_block_results.rb', line 39

def freeze
  opts[:custom_block_results].freeze
  super
end

#handle_block_result(klass, &block) ⇒ Object

Specify a block that will be called when an instance of klass is returned as a block result. The block defines a method.



46
47
48
# File 'lib/roda/plugins/custom_block_results.rb', line 46

def handle_block_result(klass, &block)
  opts[:custom_block_results][klass] = define_roda_method(opts[:custom_block_results][klass] || "custom_block_result_#{klass}", 1, &block)
end