A
anansi
Hi,
let's pretend I have a codeblock like this:
#begin
test = lambda {|c,d| @check = c if object.status == d}
test.call("GoodBoy",12)
#end
So you see if object.status is 12 @check will be set to "Goodboy".
But how can I make the block test to allow more than 2 arguments and
that any further argument will be takes as further conditional statement?
Like:
test = lambda {|c,d,e| @check = c if object.status == d or object.status
== e}
test.call("GoodBoy",24,11)
or with 4 arguments:
test = lambda {|c,d,e,f| @check = c if object.status == d or
object.status == e or object.status == f}
test.call("GoodBoy",82,31,40)
so you see what I mean?
This should just happen automatically so I wanna call test sometimes
with 2, but sometimes also with more arguments and it shall be extended
as shown above.
Is there any way in ruby to do so?
--
greets
(
)
(
/\ .-"""-. /\
//\\/ ,,, \//\\
|/\| ,;;;;;, |/\|
//\\\;-"""-;///\\
// \/ . \/ \\
(| ,-_| \ | / |_-, |)
//`__\.-.-./__`\\
// /.-(() ())-.\ \\
(\ |) '---' (| /)
` (| |) `
jgs \) (/
one must still have chaos in oneself to be able to give birth to a
dancing star
let's pretend I have a codeblock like this:
#begin
test = lambda {|c,d| @check = c if object.status == d}
test.call("GoodBoy",12)
#end
So you see if object.status is 12 @check will be set to "Goodboy".
But how can I make the block test to allow more than 2 arguments and
that any further argument will be takes as further conditional statement?
Like:
test = lambda {|c,d,e| @check = c if object.status == d or object.status
== e}
test.call("GoodBoy",24,11)
or with 4 arguments:
test = lambda {|c,d,e,f| @check = c if object.status == d or
object.status == e or object.status == f}
test.call("GoodBoy",82,31,40)
so you see what I mean?
This should just happen automatically so I wanna call test sometimes
with 2, but sometimes also with more arguments and it shall be extended
as shown above.
Is there any way in ruby to do so?
--
greets
(
)
(
/\ .-"""-. /\
//\\/ ,,, \//\\
|/\| ,;;;;;, |/\|
//\\\;-"""-;///\\
// \/ . \/ \\
(| ,-_| \ | / |_-, |)
//`__\.-.-./__`\\
// /.-(() ())-.\ \\
(\ |) '---' (| /)
` (| |) `
jgs \) (/
one must still have chaos in oneself to be able to give birth to a
dancing star