mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/delegate.rb: Added missing spaces and Removed needless spaces.
[fix GH-1454][ci skip] Patch by @bogdanvlviv git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
69846644d2
commit
22de22b292
2 changed files with 12 additions and 7 deletions
|
@ -1,3 +1,8 @@
|
|||
Wed Oct 5 11:36:21 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org>
|
||||
|
||||
* lib/delegate.rb: Added missing spaces and Removed needless spaces.
|
||||
[fix GH-1454][ci skip] Patch by @bogdanvlviv
|
||||
|
||||
Wed Oct 5 03:24:55 2016 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
|
||||
|
||||
* enum.c: Make Enumerable#chunk with no block return
|
||||
|
|
|
@ -40,7 +40,7 @@ class Delegator < BasicObject
|
|||
kernel = ::Kernel.dup
|
||||
kernel.class_eval do
|
||||
alias __raise__ raise
|
||||
[:to_s,:inspect,:=~,:!~,:===,:<=>,:eql?,:hash].each do |m|
|
||||
[:to_s, :inspect, :=~, :!~, :===, :<=>, :eql?, :hash].each do |m|
|
||||
undef_method m
|
||||
end
|
||||
private_instance_methods.each do |m|
|
||||
|
@ -175,7 +175,7 @@ class Delegator < BasicObject
|
|||
ivars = instance_variables.reject {|var| /\A@delegate_/ =~ var}
|
||||
[
|
||||
:__v2__,
|
||||
ivars, ivars.map{|var| instance_variable_get(var)},
|
||||
ivars, ivars.map {|var| instance_variable_get(var)},
|
||||
__getobj__
|
||||
]
|
||||
end
|
||||
|
@ -186,7 +186,7 @@ class Delegator < BasicObject
|
|||
def marshal_load(data)
|
||||
version, vars, values, obj = data
|
||||
if version == :__v2__
|
||||
vars.each_with_index{|var, i| instance_variable_set(var, values[i])}
|
||||
vars.each_with_index {|var, i| instance_variable_set(var, values[i])}
|
||||
__setobj__(obj)
|
||||
else
|
||||
__setobj__(data)
|
||||
|
@ -234,7 +234,7 @@ class Delegator < BasicObject
|
|||
end
|
||||
|
||||
@delegator_api = self.public_instance_methods
|
||||
def self.public_api # :nodoc:
|
||||
def self.public_api # :nodoc:
|
||||
@delegator_api
|
||||
end
|
||||
end
|
||||
|
@ -305,7 +305,7 @@ end
|
|||
# Non-Nil: 7
|
||||
# Unique: 6
|
||||
#
|
||||
class SimpleDelegator<Delegator
|
||||
class SimpleDelegator < Delegator
|
||||
# Returns the current object method calls are being delegated to.
|
||||
def __getobj__
|
||||
unless defined?(@delegate_sd_obj)
|
||||
|
@ -379,9 +379,9 @@ def DelegateClass(superclass)
|
|||
klass = Class.new(Delegator)
|
||||
methods = superclass.instance_methods
|
||||
methods -= ::Delegator.public_api
|
||||
methods -= [:to_s,:inspect,:=~,:!~,:===]
|
||||
methods -= [:to_s, :inspect, :=~, :!~, :===]
|
||||
klass.module_eval do
|
||||
def __getobj__ # :nodoc:
|
||||
def __getobj__ # :nodoc:
|
||||
unless defined?(@delegate_dc_obj)
|
||||
return yield if block_given?
|
||||
__raise__ ::ArgumentError, "not delegated"
|
||||
|
|
Loading…
Reference in a new issue