Skip to content

Instantly share code, notes, and snippets.

@mxriverlynn
Created September 21, 2009 19:36
Show Gist options
  • Save mxriverlynn/190494 to your computer and use it in GitHub Desktop.
Save mxriverlynn/190494 to your computer and use it in GitHub Desktop.
def build_options(option_name, option_values={})
if (option_values.length > 0)
option_text = "/#{option_name}:"
if (option_values.kind_of?(Hash))
option_text << process_hash(option_values)
else
option_text << process_array(option_values)
end
option_text = option_text.chop
end
option_text
end
def process_hash(option_values={})
option_text = ''
option_values.each do |key, value|
option_text << "#{key}\=#{value};"
end
option_text
end
def process_array(option_values={})
option_text = ''
option_values.each do |key|
option_text << "#{key};"
end
option_text
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment