Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #2303

Re: Autoconvert object from one class1 to other class2 in class1 def

From Luk Mus <support@fit4u.su>
Newsgroups comp.lang.ruby
Subject Re: Autoconvert object from one class1 to other class2 in class1 def
Date 2011-04-05 03:19 -0500
Organization Service de news de lacave.net
Message-ID <670986c859eadfac73e33b9e682aba39@ruby-forum.com> (permalink)
References <5095fcbac456c1c2b31e5c05fbea960d@ruby-forum.com>

Show all headers | View raw


or how get name of variable in class method?
I mean that may be:

class String
 def to_i!
  # i don't know what is real name of this method (get_name_of_variable)
  name=self.get_name_of_variable
  eval("#{name}=#{name}.to_i")
 end
end

-- 
Posted via http://www.ruby-forum.com/.

Back to comp.lang.ruby | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Autoconvert object from one class1 to other class2 in class1 def Luk Mus <support@fit4u.su> - 2011-04-05 03:02 -0500
  Re: Autoconvert object from one class1 to other class2 in class1 def Luk Mus <support@fit4u.su> - 2011-04-05 03:19 -0500
  Re: Autoconvert object from one class1 to other class2 in class1 def Brian Candler <b.candler@pobox.com> - 2011-04-05 03:46 -0500
    Re: Autoconvert object from one class1 to other class2 in class1 def Luk Mus <support@fit4u.su> - 2011-04-05 04:15 -0500
      Re: Autoconvert object from one class1 to other class2 in class1 def Brian Candler <b.candler@pobox.com> - 2011-04-05 07:41 -0500
      Re: Autoconvert object from one class1 to other class2 in class1 def Adam Prescott <adam@aprescott.com> - 2011-04-05 07:50 -0500
      Re: Autoconvert object from one class1 to other class2 in class1 def Robert Klemme <shortcutter@googlemail.com> - 2011-04-05 07:56 -0500

csiph-web