Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/spec/runner/extensions/object.rb,
lib/spec/mocks/extensions/object.rb,
lib/spec/callback/extensions/object.rb,
lib/spec/expectations/extensions/object.rb
Overview
The following copyright applies to Object#copy_instance_variables_from, which we borrowed from active_support.
Copyright © 2004 David Heinemeier Hansson
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Instance Method Summary collapse
-
#copy_instance_variables_from(object, exclude = []) ⇒ Object
From active_support.
Methods included from Spec::Expectations::ObjectExpectations
Methods included from Callback::InstanceMethods
#register_callback, #unregister_callback
Methods included from Spec::Mocks::Methods
#__reset_mock, #__verify, #method_missing, #received_message?, #should_not_receive, #should_receive, #stub!
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Spec::Mocks::Methods
Instance Method Details
#copy_instance_variables_from(object, exclude = []) ⇒ Object
From active_support
26 27 28 29 30 31 |
# File 'lib/spec/runner/extensions/object.rb', line 26 def copy_instance_variables_from(object, exclude = []) # :nodoc: exclude += object.protected_instance_variables if object.respond_to? :protected_instance_variables instance_variables = object.instance_variables - exclude.map { |name| name.to_s } instance_variables.each { |name| instance_variable_set(name, object.instance_variable_get(name)) } end |