зеркало из https://github.com/github/ruby.git
* class.c: fix camelCase to snake_case in documentation code examples.
patched by Andrew Grimm. fixes Bug #4469 * marshal.c: ditto. * proc.c: ditto. * sample/biorhythm.rb: ditto. * vm_eval.c: ditto. * vm_method.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31031 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
7f1362a84e
Коммит
18f4f08885
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
|||
Sun Mar 6 05:21:41 2011 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* class.c: fix camelCase to snake_case in documentation code examples.
|
||||
patched by Andrew Grimm. fixes Bug #4469
|
||||
|
||||
* marshal.c: ditto.
|
||||
|
||||
* proc.c: ditto.
|
||||
|
||||
* sample/biorhythm.rb: ditto.
|
||||
|
||||
* vm_eval.c: ditto.
|
||||
|
||||
* vm_method.c: ditto.
|
||||
|
||||
|
||||
Sun Mar 6 03:22:27 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||
|
||||
* io.c (io_cntl): use rb_thread_io_blocking_region() instead
|
||||
|
|
10
class.c
10
class.c
|
@ -988,14 +988,14 @@ rb_class_public_instance_methods(int argc, VALUE *argv, VALUE mod)
|
|||
* <i>obj</i>'s ancestors.
|
||||
*
|
||||
* class Klass
|
||||
* def kMethod()
|
||||
* def klass_method()
|
||||
* end
|
||||
* end
|
||||
* k = Klass.new
|
||||
* k.methods[0..9] #=> [:kMethod, :freeze, :nil?, :is_a?,
|
||||
* # :class, :instance_variable_set,
|
||||
* # :methods, :extend, :__send__, :instance_eval]
|
||||
* k.methods.length #=> 42
|
||||
* k.methods[0..9] #=> [:klass_method, :nil?, :===,
|
||||
* # :==~, :!, :eql?
|
||||
* # :hash, :<=>, :class, :singleton_class]
|
||||
* k.methods.length #=> 57
|
||||
*/
|
||||
|
||||
VALUE
|
||||
|
|
|
@ -876,7 +876,7 @@ clear_dump_arg(struct dump_arg *arg)
|
|||
* def initialize(str)
|
||||
* @str = str
|
||||
* end
|
||||
* def sayHello
|
||||
* def say_hello
|
||||
* @str
|
||||
* end
|
||||
* end
|
||||
|
@ -886,7 +886,7 @@ clear_dump_arg(struct dump_arg *arg)
|
|||
* o = Klass.new("hello\n")
|
||||
* data = Marshal.dump(o)
|
||||
* obj = Marshal.load(data)
|
||||
* obj.sayHello #=> "hello\n"
|
||||
* obj.say_hello #=> "hello\n"
|
||||
*
|
||||
* Marshal can't dump following objects:
|
||||
* * anonymous Class/Module.
|
||||
|
|
14
proc.c
14
proc.c
|
@ -336,10 +336,10 @@ rb_binding_new(void)
|
|||
* calling +eval+ to execute the evaluated command in this
|
||||
* environment. Also see the description of class +Binding+.
|
||||
*
|
||||
* def getBinding(param)
|
||||
* def get_binding(param)
|
||||
* return binding
|
||||
* end
|
||||
* b = getBinding("hello")
|
||||
* b = get_binding("hello")
|
||||
* eval("param", b) #=> "hello"
|
||||
*/
|
||||
|
||||
|
@ -358,10 +358,10 @@ rb_f_binding(VALUE self)
|
|||
* <em>lineno</em> parameters are present, they will be used when
|
||||
* reporting syntax errors.
|
||||
*
|
||||
* def getBinding(param)
|
||||
* def get_binding(param)
|
||||
* return binding
|
||||
* end
|
||||
* b = getBinding("hello")
|
||||
* b = get_binding("hello")
|
||||
* b.eval("param") #=> "hello"
|
||||
*/
|
||||
|
||||
|
@ -2211,15 +2211,15 @@ Init_Proc(void)
|
|||
* def initialize(n)
|
||||
* @secret = n
|
||||
* end
|
||||
* def getBinding
|
||||
* def get_binding
|
||||
* return binding()
|
||||
* end
|
||||
* end
|
||||
*
|
||||
* k1 = Demo.new(99)
|
||||
* b1 = k1.getBinding
|
||||
* b1 = k1.get_binding
|
||||
* k2 = Demo.new(-3)
|
||||
* b2 = k2.getBinding
|
||||
* b2 = k2.get_binding
|
||||
*
|
||||
* eval("@secret", b1) #=> 99
|
||||
* eval("@secret", b2) #=> -3
|
||||
|
|
|
@ -29,13 +29,13 @@ require "date.rb"
|
|||
require "optparse"
|
||||
require "optparse/date"
|
||||
|
||||
def printHeader(y, m, d, p, w)
|
||||
def print_header(y, m, d, p, w)
|
||||
print "\n>>> Biorhythm <<<\n"
|
||||
printf "The birthday %04d.%02d.%02d is a %s\n", y, m, d, w
|
||||
printf "Age in days: [%d]\n\n", p
|
||||
end
|
||||
|
||||
def getPosition(z)
|
||||
def get_position(z)
|
||||
pi = Math::PI
|
||||
z = Integer(z)
|
||||
phys = (50.0 * (1.0 + sin((z / 23.0 - (z / 23)) * 360.0 * pi / 180.0))).to_i
|
||||
|
@ -89,24 +89,24 @@ ausgabeart = options[:graph] ? "g" : "v"
|
|||
display_period = options[:days]
|
||||
|
||||
if ausgabeart == "v"
|
||||
printHeader(bd.year, bd.month, bd.day, dd - bd, bd.strftime("%a"))
|
||||
print_header(bd.year, bd.month, bd.day, dd - bd, bd.strftime("%a"))
|
||||
print "\n"
|
||||
|
||||
phys, emot, geist = getPosition(dd - bd)
|
||||
phys, emot, geist = get_position(dd - bd)
|
||||
printf "Biorhythm: %04d.%02d.%02d\n", dd.year, dd.month, dd.day
|
||||
printf "Physical: %d%%\n", phys
|
||||
printf "Emotional: %d%%\n", emot
|
||||
printf "Mental: %d%%\n", geist
|
||||
print "\n"
|
||||
else
|
||||
printHeader(bd.year, bd.month, bd.day, dd - bd, bd.strftime("%a"))
|
||||
print_header(bd.year, bd.month, bd.day, dd - bd, bd.strftime("%a"))
|
||||
print " P=physical, E=emotional, M=mental\n"
|
||||
print " -------------------------+-------------------------\n"
|
||||
print " Bad Condition | Good Condition\n"
|
||||
print " -------------------------+-------------------------\n"
|
||||
|
||||
(dd - bd).step(dd - bd + display_period) do |z|
|
||||
phys, emot, geist = getPosition(z)
|
||||
phys, emot, geist = get_position(z)
|
||||
|
||||
printf "%04d.%02d.%02d : ", dd.year, dd.month, dd.day
|
||||
p = (phys / 2.0 + 0.5).to_i
|
||||
|
|
|
@ -459,12 +459,12 @@ NORETURN(static void raise_method_missing(rb_thread_t *th, int argc, const VALUE
|
|||
* values.
|
||||
*
|
||||
* class Roman
|
||||
* def romanToInt(str)
|
||||
* def roman_to_int(str)
|
||||
* # ...
|
||||
* end
|
||||
* def method_missing(methId)
|
||||
* str = methId.id2name
|
||||
* romanToInt(str)
|
||||
* roman_to_int(str)
|
||||
* end
|
||||
* end
|
||||
*
|
||||
|
@ -1082,12 +1082,12 @@ eval_string(VALUE self, VALUE src, VALUE scope, const char *file, int line)
|
|||
* optional <em>filename</em> and <em>lineno</em> parameters are
|
||||
* present, they will be used when reporting syntax errors.
|
||||
*
|
||||
* def getBinding(str)
|
||||
* def get_binding(str)
|
||||
* return binding
|
||||
* end
|
||||
* str = "hello"
|
||||
* eval "str + ' Fred'" #=> "hello Fred"
|
||||
* eval "str + ' Fred'", getBinding("bye") #=> "bye Fred"
|
||||
* eval "str + ' Fred'", get_binding("bye") #=> "bye Fred"
|
||||
*/
|
||||
|
||||
VALUE
|
||||
|
|
|
@ -1152,20 +1152,20 @@ top_private(int argc, VALUE *argv)
|
|||
* end
|
||||
* class Cls
|
||||
* include Mod
|
||||
* def callOne
|
||||
* def call_one
|
||||
* one
|
||||
* end
|
||||
* end
|
||||
* Mod.one #=> "This is one"
|
||||
* c = Cls.new
|
||||
* c.callOne #=> "This is one"
|
||||
* c.call_one #=> "This is one"
|
||||
* module Mod
|
||||
* def one
|
||||
* "This is the new one"
|
||||
* end
|
||||
* end
|
||||
* Mod.one #=> "This is one"
|
||||
* c.callOne #=> "This is the new one"
|
||||
* c.call_one #=> "This is the new one"
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
|
|
Загрузка…
Ссылка в новой задаче