6873fc8026
Upgraded to Rails 2.0.2, except that we maintain vendor/rails/actionpack/lib/action_controller/routing.rb from Rail 1.2.6 (at least for now), so that Routes don't change. We still get to enjoy Rails's many new features. Also fixed a bug in Chunk-handling: disable WikiWord processing in tags (for real this time).
23 lines
718 B
Ruby
23 lines
718 B
Ruby
class Object
|
|
# Available in 1.8.6 and later.
|
|
unless respond_to?(:instance_variable_defined?)
|
|
def instance_variable_defined?(variable)
|
|
instance_variables.include?(variable.to_s)
|
|
end
|
|
end
|
|
|
|
def instance_values #:nodoc:
|
|
instance_variables.inject({}) do |values, name|
|
|
values[name.to_s[1..-1]] = instance_variable_get(name)
|
|
values
|
|
end
|
|
end
|
|
|
|
def copy_instance_variables_from(object, exclude = []) #:nodoc:
|
|
exclude += object.protected_instance_variables if object.respond_to? :protected_instance_variables
|
|
|
|
vars = object.instance_variables.map(&:to_s) - exclude.map(&:to_s)
|
|
vars.each { |name| instance_variable_set(name, object.instance_variable_get(name)) }
|
|
end
|
|
end
|