Created
February 7, 2015 06:15
-
-
Save compwron/986de57d7c66c5b5bf14 to your computer and use it in GitHub Desktop.
find unused date formats
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = "apache | |
batch_name | |
datetime_with_seconds | |
download_csv_datetime | |
download_csv_timezone | |
expiration | |
mmdd | |
mmyy | |
hhmmss | |
iso8601_milliseconds | |
receipt | |
short_date | |
short_date_dialog | |
short_datetime | |
time_with_seconds | |
short_military | |
long_date | |
time_with_zone | |
transparent_redirect | |
yymmdd | |
adyen_event_date | |
date_hour_minute_second_millis " | |
b = a.split("\n").map {|i| i.strip} | |
c = b.map {|format| | |
app_res = `grep -Rin ".to_s(:#{format}" app` | |
spec_res = `grep -Rin ".to_s(:#{format}" spec` | |
res = app_res + "\n" + spec_res | |
puts res | |
[format, res] | |
} | |
d = c.select{|format, res| | |
(res == "" || res == "\n") | |
}.map { |format, res| | |
format | |
} | |
puts "unused formats: #{d}" | |
# unused formats: ["apache", "expiration", "mmyy", "short_military", "time_with_zone"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment