Ruby : Defaulted optional arguments
I'd seen this technique, but I'd lost it.
def placeholder(requiredarg, options = {})
  # set default options
  o = { :class => 'placeholder', :tag => 'p' }.merge(options)
  ...
end
Jason's Rant...I mean Blog
I'd seen this technique, but I'd lost it.
def placeholder(requiredarg, options = {})
  # set default options
  o = { :class => 'placeholder', :tag => 'p' }.merge(options)
  ...
end
1 comment:
thanks... i forgot this one too..
making a note myself
Post a Comment