lib/grape/api.rb in grape-1.5.3 vs lib/grape/api.rb in grape-1.6.0

- old
+ new

@@ -18,14 +18,15 @@ base_instance.new(*args, &block) end # When inherited, will create a list of all instances (times the API was mounted) # It will listen to the setup required to mount that endpoint, and replicate it on any new instance - def inherited(api, base_instance_parent = Grape::API::Instance) - api.initial_setup(base_instance_parent) + def inherited(api) + super + + api.initial_setup(Grape::API == self ? Grape::API::Instance : @base_instance) api.override_all_methods! - make_inheritable(api) end # Initialize the instance variables on the remountable class, and the base_instance # an instance that will be used to create the set up but will not be mounted def initial_setup(base_instance_parent) @@ -66,19 +67,10 @@ # NOTE: This will only be called on an API directly mounted on RACK def call(*args, &block) instance_for_rack.call(*args, &block) end - # Allows an API to itself be inheritable: - def make_inheritable(api) - # When a child API inherits from a parent API. - def api.inherited(child_api) - # The instances of the child API inherit from the instances of the parent API - Grape::API.inherited(child_api, base_instance) - end - end - # Alleviates problems with autoloading by tring to search for the constant def const_missing(*args) if base_instance.const_defined?(*args) base_instance.const_get(*args) else @@ -149,9 +141,10 @@ last_response end def replay_step_on(instance, setup_step) return if skip_immediate_run?(instance, setup_step[:args]) + args = evaluate_arguments(instance.configuration, *setup_step[:args]) response = instance.send(setup_step[:method], *args, &setup_step[:block]) if skip_immediate_run?(instance, [response]) response else