S
S. Robert James
What is the "returning" keyword? It's usually used with a block, but I
can't find what it is.
can't find what it is.
What is the "returning" keyword? It's usually used with a block, but I
can't find what it is.
S. Robert James said:Thanks.
Wow! That's an example of clever code. The code's less clear, no
shorter, and confusing to someone not familiar with this new method -
and for what? To be able to show off cool meta programming?
I think Rails is great, but someone needs to remind people that "clever
code" is an insult.
Thanks.
Wow! That's an example of clever code. The code's less clear, no
shorter, and confusing to someone not familiar with this new method -
and for what? To be able to show off cool meta programming?
I think Rails is great, but someone needs to remind people that "clever
code" is an insult.
Thanks.
Wow! That's an example of clever code. The code's less clear, no
shorter, and confusing to someone not familiar with this new method -
and for what? To be able to show off cool meta programming?
I think Rails is great, but someone needs to remind people that "clever
code" is an insult.
I still maintain that this is clever code. Every new (pseudo)keyword comes
at a cost, of having to learn (and keep in your head) something new. They
have to justify their cost by truly cleaning up the code - and I haven't
seen an example of that yet.
^^that is a reasonable thing to say - imho you'd need something like this to do
so
def factory
returning Object.new do |o|
o.property_0 = 'value_0'
o.property_1 = 'value_1'
o.property_2 = 'value_2'
o.property_3 = 'value_3'
o.property_4 = 'value_4'
o.property_5 = 'value_5'
o.property_6 = 'value_6'
o.property_7 = 'value_7'
o.property_8 = 'value_8'
o.property_9 = 'value_9'
o.property_10 = 'value_10'
o.property_11 = 'value_11'
o.property_12 = 'value_12'
o.property_13 = 'value_13'
o.property_14 = 'value_14'
o.property_15 = 'value_15'
o.property_16 = 'value_16'
o.property_17 = 'value_17'
o.property_18 = 'value_18'
o.property_19 = 'value_19'
o.property_20 = 'value_20'
o.property_21 = 'value_21'
o.property_22 = 'value_22'
o.property_23 = 'value_23'
o.property_24 = 'value_24'
o.property_25 = 'value_25'
o.property_26 = 'value_26'
o.property_27 = 'value_27'
o.property_28 = 'value_28'
o.property_29 = 'value_29'
o.property_30 = 'value_30'
o.property_31 = 'value_31'
o.property_32 = 'value_32'
o.property_33 = 'value_33'
o.property_34 = 'value_34'
o.property_35 = 'value_35'
o.property_36 = 'value_36'
o.property_37 = 'value_37'
o.property_38 = 'value_38'
o.property_39 = 'value_39'
o.property_40 = 'value_40'
o.property_41 = 'value_41'
o.property_42 = 'value_42'
o.property_43 = 'value_43'
On Tue, 14 Nov 2006, S. Robert James wrote:
=20
=20
that is a reasonable thing to say - imho you'd need something like this=
to do
so
=20
=20
def factory
returning Object.new do |o|
o.property_0 =3D 'value_0'
[snip]
o.property_127 =3D 'value_127'
end
end
=20
-a
I still maintain that this is clever code. Every new (pseudo)keyword
comes at a cost, of having to learn (and keep in your head) something
new. They have to justify their cost by truly cleaning up the code -
and I haven't seen an example of that yet.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.