[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dennou-ruby:001199] Re: [ANN] RubyDCL 1.1.0



At Mon, 20 May 2002 15:14:21 +0900,
Takeshi Horinouchi wrote:

> 锟斤拷锟疥ア锟斤拷锟斤拷铜锟斤拷锟角はなわ拷锟轿わ拷锟斤拷锟斤拷锟饺わ拷锟狡も、udcntr 锟斤拷锟斤拷扦锟斤拷锟斤拷皮锟斤拷
> 锟斤拷锟绞わ拷锟斤拷韦锟� module_function 锟剿わ拷锟狡なわ拷锟饺なわ拷胜锟斤拷盲锟角硷拷锟斤拷锟斤拷锟斤拷锟�
> 锟绞わ拷锟斤拷__udcntr 锟较プライ锟劫★拷锟饺なメソ锟矫ドにわ拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷伞锟斤拷嗓锟斤拷锟�
> 锟斤拷肖锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷..锟斤拷

锟饺りあ锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟轿はどわ拷锟角わ拷锟界う?

  class Module
    def module_function_subroutine(*arg)
      arg.each do |s|
        module_function s
        private_class_method s
      end
    end
  end

  module Test
    def hello
      p hello_str
    end

    module_function(:hello)

    def hello_str
      "HELLO"
    end

    module_function_subroutine(:hello_str)

  end

  begin
    Test.hello     #=> "HELLO"
    Test.hello_str
  rescue Exception
    p $!  #<NoMethodError: private method `hello_str' called for Test:Module>
  end

-- Gotoken