Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
4e4bcb4c
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4e4bcb4c
编写于
5月 31, 2008
作者:
J
Jeremy Kemper
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Ruby 1.8.7 compat: TimeWithZone# and Chars#respond_to? pass along the include_private argument
上级
2243ffd1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
11 addition
and
9 deletion
+11
-9
activesupport/lib/active_support/multibyte/chars.rb
activesupport/lib/active_support/multibyte/chars.rb
+7
-5
activesupport/lib/active_support/time_with_zone.rb
activesupport/lib/active_support/time_with_zone.rb
+4
-4
未找到文件。
activesupport/lib/active_support/multibyte/chars.rb
浏览文件 @
4e4bcb4c
...
...
@@ -40,13 +40,15 @@ def to_str
# core dumps. Don't go there.
@string
end
# Make duck-typing with String possible
def
respond_to?
(
method
)
super
||
@string
.
respond_to?
(
method
)
||
handler
.
respond_to?
(
method
)
||
(
method
.
to_s
=~
/(.*)!/
&&
handler
.
respond_to?
(
$1
))
||
false
def
respond_to?
(
method
,
include_priv
=
false
)
super
||
@string
.
respond_to?
(
method
,
include_priv
)
||
handler
.
respond_to?
(
method
,
include_priv
)
||
(
method
.
to_s
=~
/(.*)!/
&&
handler
.
respond_to?
(
$1
,
include_priv
))
||
false
end
# Create a new Chars instance.
def
initialize
(
str
)
@string
=
str
.
respond_to?
(
:string
)
?
str
.
string
:
str
...
...
activesupport/lib/active_support/time_with_zone.rb
浏览文件 @
4e4bcb4c
...
...
@@ -248,14 +248,14 @@ def marshal_dump
def
marshal_load
(
variables
)
initialize
(
variables
[
0
],
::
Time
.
send!
(
:get_zone
,
variables
[
1
]),
variables
[
2
])
end
# Ensure proxy class responds to all methods that underlying time instance responds to.
def
respond_to?
(
sym
)
def
respond_to?
(
sym
,
include_priv
=
false
)
# consistently respond false to acts_like?(:date), regardless of whether #time is a Time or DateTime
return
false
if
sym
.
to_s
==
'acts_like_date?'
super
||
time
.
respond_to?
(
sym
)
super
||
time
.
respond_to?
(
sym
,
include_priv
)
end
# Send the missing method to +time+ instance, and wrap result in a new TimeWithZone with the existing +time_zone+.
def
method_missing
(
sym
,
*
args
,
&
block
)
result
=
time
.
__send__
(
sym
,
*
args
,
&
block
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录