Method For Making Methods: Easy Ruby Metaprogramming

Posted by yar on Stack Overflow See other posts from Stack Overflow or by yar
Published on 2010-05-17T21:08:02Z Indexed on 2010/05/17 21:10 UTC
Read the original article Hit count: 232

Filed under:
|

I have a bunch of methods like this in view helper

  def background
    "#e9eaec"
  end
  def footer_link_color
    "#836448"
  end

I'd like these methods exposed to the view, but I'd prefer the helper to be a bit more concise. What's the best way to turn a hash, say, into methods (or something else)?

© Stack Overflow or respective owner

Related posts about ruby

Related posts about metaprogramming