Skip to content

Instantly share code, notes, and snippets.

@timuruski
Created August 16, 2011 20:40
Show Gist options
  • Select an option

  • Save timuruski/1150114 to your computer and use it in GitHub Desktop.

Select an option

Save timuruski/1150114 to your computer and use it in GitHub Desktop.
There has to to be a better way to build a hash.
def get_providers()
plugins= get_plugins()
ary= plugins.get_providers()
h= {}
h["providers"] = ary
h
end
# Why not do this?
def get_providers
{ :providers => get_plugins.get_providers }
end
# Renamed methods make it easy to understand
def providers_hash
{ :providers => plugins.providers }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment