Ruby On ruby metaprogramming

by micktaiwan, January 23, 2009 20:16

Thanks but Daniel solved my...

2f6686bd2c6bb633a1cbf7b5a73c8491 Talk
object.constraints.each do |c|
  p = object.particles[c.index]
  p.component_set(c.component,c.value) if p.component_value(c.component).send(c.dir, c.value)
...

Ruby On ruby metaprogramming

by micktaiwan, January 06, 2009 02:32

And by replacing :inf or :s...

2f6686bd2c6bb633a1cbf7b5a73c8491 Talk
class SomeObject
  def component_set(component,value)
    send("#{component}=", value)
...

Ruby On ruby metaprogramming

by micktaiwan, January 06, 2009 02:19

Nice ! Thanks.

So I unders...

2f6686bd2c6bb633a1cbf7b5a73c8491 Talk
object.constraints.each do |c|
  p = object.particles[c.index]
  if c.component == :x
...

Ruby ruby metaprogramming

by micktaiwan, January 06, 2009 00:30, 7 refactorings, tagged with ruby, metaprogramming

So here here my ugly code. ...

2f6686bd2c6bb633a1cbf7b5a73c8491 Talk