Module: Roda::RodaPlugins::ShapeFriendly::ClassMethods

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

Instance Method Summary collapse

Instance Method Details

#plugin(plugin, *args, &block) ⇒ Object

Automatically refresh the instance variables used if the plugin sets instance variables.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/roda/plugins/shape_friendly.rb', line 79

def plugin(plugin, *args, &block)
  super
  plugin = RodaPlugins.load_plugin(plugin) if plugin.is_a?(Symbol)
  [
    [self, :SCOPE_INSTANCE_VARIABLES],
    [self::RodaRequest, :REQUEST_INSTANCE_VARIABLES],
    [self::RodaResponse, :RESPONSE_INSTANCE_VARIABLES],
  ].each do |klass, ivs_const|
    if plugin.const_defined?(ivs_const)
      def_initialize_nil_instance_variables(klass, ivs_const)
    end
  end
  nil
end