Skip to content

Instantly share code, notes, and snippets.

@andrei512
Created February 4, 2016 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrei512/4944194b4f6d71a06120 to your computer and use it in GitHub Desktop.
Save andrei512/4944194b4f6d71a06120 to your computer and use it in GitHub Desktop.
prop_regex = /@property\s*\([^\)]+\)\s+(?<type>\w+(\s*\*)?)\s*(?<name>\w+)/
code = `pbpaste`
property_list = []
code.scan(prop_regex) do |match|
type, name = match
type.gsub!(" ", "")
property_list << {
type: type,
name: name
}
end
output = "PTK_CODING_COPYING_EQUAL_HASH((selist(" + property_list.map {|x| x[:name]}.join(", ") + ") ))"
`echo #{output.inspect} | pbcopy`
PTK_CODING_COPYING_EQUAL_HASH((selist(alias, addressId, state, county, postCode, city, line1, line2, country, firstName, lastName) ))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment