Project

General

Profile

Bug #4469 ยป fix_camel_case_method_names.patch

Patch to fix the problem - agrimm (Andrew Grimm), 03/05/2011 09:53 PM

View differences:

class.c
* <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
marshal.c
* def initialize(str)
* @str = str
* end
* def sayHello
* def say_hello
* @str
* end
* end
......
* 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.
proc.c
* 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"
*/
......
* <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"
*/
......
* 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
sample/biorhythm.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
......
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
vm_eval.c
* 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
*
......
* 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
vm_method.c
* 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
    (1-1/1)