How to initialize the object of expression?

Hi,

It has a lot of expressions in a file.

such as:
int_a = 5, str_b = “Hello”

I want to parse the expressions, so define the object of Parameter.

class Parameter
def initialize(name,value)
@name = name
@value = value
#@range = range
end
def to_s
“#@name = @value
#"#@name = @value|#@value"
end
end

But,How to initialize the object of expression?

I only know one method:

  1. find"="
  2. read left/right string of “=”
  3. a=Parameter.new(left,right)

but it’s not good. :frowning:
How to parse it? such as Parameter(“ABC=5”)

On Fri, Sep 17, 2010 at 11:07 PM, iMelody Cn [email protected] wrote:

How to parse it? such as Parameter(“ABC=5”)

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

ri String#split