Skip to content

Instantly share code, notes, and snippets.

@3lvis
Forked from orta/remove_headers.rb
Last active August 15, 2016 09:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 3lvis/50257fa2967b845b104b to your computer and use it in GitHub Desktop.
Save 3lvis/50257fa2967b845b104b to your computer and use it in GitHub Desktop.
def should_crop(lines)
(0..6).each do |n|
return false unless lines[n].start_with? "//"
end
return false unless lines[7] = ""
true
end
all_objc = Dir.glob("Classes/**/**/**/**.{m,h}")
all_objc.each do |path|
content = File.read path
lines = content.lines
next unless should_crop(lines)
lines = lines[6..-1]
new_content = content.lines[8..-1].join
File.write path, new_content
end
@heumn
Copy link

heumn commented Jul 1, 2015

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment