apotonick/roar — pull request #58 by ashmoran (2013-02-05 01:34:21+00:00)
Title: Make the attribute accessor code in Client a bit shorter

While I was reading the ROAR source I noticed the following code commented with a request for someone to clean it up a bit:

```ruby
# TODO: could anyone please make this better?
instance_eval %Q{
def #{name}=(v)
@#{name} = v
end

def #{name}
@#{name}
end
}
```

So I had a go…

https://github.com/apotonick/roar/blob/master/lib/roar/representer/feature/client.rb#L16-L25

This is only a quick hack. The tests don't care whether I evaluate it into the host object's class or singleton class, and I didn't stop to think about any other uncaught bugs this might introduce. But at least it's removed the nested string eval.