edtf-humanize 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/edtf/humanize.rb +4 -4
- data/lib/edtf/humanize/century.rb +1 -1
- data/lib/edtf/humanize/decade.rb +1 -1
- data/lib/edtf/humanize/formats.rb +1 -1
- data/lib/edtf/humanize/set.rb +9 -7
- data/lib/edtf/humanize/version.rb +1 -1
- data/test/dummy/config/application.rb +7 -1
- data/test/dummy/config/environments/development.rb +1 -1
- data/test/dummy/config/environments/production.rb +1 -1
- data/test/dummy/log/test.log +176 -0
- data/test/test_helper.rb +1 -1
- metadata +10 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ee4450eeb42029edd41bbb6b58dd24e66ae1fd8
|
4
|
+
data.tar.gz: 1491fe02881b157527af1121d6a9fffddf461e49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18462c0ce9aa3cd1919666f421cf8da6b059cceb931a1d37f578286eaaf430b80c7dd5dfc1a3989279eb31554d32b4849e8464cf88493dd3403a88dc7aa20d78
|
7
|
+
data.tar.gz: bb7833b4a6c7586b3f0b8e73d436ef4dd5b1f395f9f0f8380c5e95abf5f7ad3ea995271a67d50585ea2dc0de5663c63bfd872cb7f8603caacd1b65decf534283
|
data/lib/edtf/humanize.rb
CHANGED
@@ -56,12 +56,12 @@ module Edtf
|
|
56
56
|
@year_precision_strftime_format = "%Y"
|
57
57
|
|
58
58
|
@approximate_date_prefix = "circa "
|
59
|
-
|
59
|
+
|
60
60
|
@uncertain_date_suffix = "?"
|
61
|
-
|
61
|
+
|
62
62
|
@decade_suffix = "s"
|
63
63
|
@century_suffix = "s"
|
64
|
-
|
64
|
+
|
65
65
|
@unspecified_digit_substitute = "x"
|
66
66
|
|
67
67
|
@interval_connector = " to "
|
@@ -75,6 +75,6 @@ module Edtf
|
|
75
75
|
end
|
76
76
|
|
77
77
|
end
|
78
|
-
|
78
|
+
|
79
79
|
end
|
80
80
|
end
|
data/lib/edtf/humanize/decade.rb
CHANGED
@@ -32,7 +32,7 @@ module Edtf
|
|
32
32
|
def month_precision_format date
|
33
33
|
date.strftime(Edtf::Humanize.configuration.month_precision_strftime_format)
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
# 1995
|
37
37
|
def year_precision_format date
|
38
38
|
date.strftime(Edtf::Humanize.configuration.year_precision_strftime_format)
|
data/lib/edtf/humanize/set.rb
CHANGED
@@ -5,15 +5,17 @@ module Edtf
|
|
5
5
|
include Edtf::Humanize::Formats
|
6
6
|
|
7
7
|
def humanize
|
8
|
-
|
9
|
-
|
10
|
-
display << "#{apply_if_approximate(date)}#{simple_date_format(date)}"
|
11
|
-
end
|
12
|
-
display.to_sentence(
|
13
|
-
words_connector: Edtf::Humanize.configuration.set_dates_connector,
|
8
|
+
format_set_entries(self).to_sentence(
|
9
|
+
words_connector: Edtf::Humanize.configuration.set_dates_connector,
|
14
10
|
last_word_connector: Edtf::Humanize.configuration.set_last_date_connector,
|
15
11
|
two_words_connector: Edtf::Humanize.configuration.set_two_dates_connector
|
16
|
-
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def format_set_entries(dates)
|
18
|
+
dates.entries.map { |date| "#{apply_if_approximate(date)}#{simple_date_format(date)}" }
|
17
19
|
end
|
18
20
|
|
19
21
|
end
|
@@ -1,6 +1,12 @@
|
|
1
1
|
require File.expand_path('../boot', __FILE__)
|
2
2
|
|
3
|
-
require
|
3
|
+
require "active_model/railtie"
|
4
|
+
# require "active_record/railtie"
|
5
|
+
require "action_controller/railtie"
|
6
|
+
require "action_mailer/railtie"
|
7
|
+
require "action_view/railtie"
|
8
|
+
require "sprockets/railtie"
|
9
|
+
require "rails/test_unit/railtie"
|
4
10
|
|
5
11
|
Bundler.require(*Rails.groups)
|
6
12
|
require "edtf-humanize"
|
@@ -20,7 +20,7 @@ Rails.application.configure do
|
|
20
20
|
config.active_support.deprecation = :log
|
21
21
|
|
22
22
|
# Raise an error on page load if there are pending migrations.
|
23
|
-
config.active_record.migration_error = :page_load
|
23
|
+
# config.active_record.migration_error = :page_load
|
24
24
|
|
25
25
|
# Debug mode disables concatenation and preprocessing of assets.
|
26
26
|
# This option may cause significant delays in view rendering with a large
|
data/test/dummy/log/test.log
CHANGED
@@ -863,3 +863,179 @@ HumanizeSetTest: test_should_return_a_humanized_set_string
|
|
863
863
|
HumanizeApproximateIntervalTest: test_should_return_a_humanized_approximate_interval_string
|
864
864
|
-------------------------------------------------------------------------------------------
|
865
865
|
[1m[35m (0.0ms)[0m rollback transaction
|
866
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
867
|
+
--------------------------------------------------------------------
|
868
|
+
HumanizeIntervalTest: test_should_return_a_humanized_interval_string
|
869
|
+
--------------------------------------------------------------------
|
870
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
871
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
872
|
+
----------------------------------------------------------------
|
873
|
+
HumanizeSeasonTest: test_should_return_a_humanized_season_string
|
874
|
+
----------------------------------------------------------------
|
875
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
876
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
877
|
+
------------------------------------------------------------------
|
878
|
+
HumanizeCenturyTest: test_should_return_a_humanized_century_string
|
879
|
+
------------------------------------------------------------------
|
880
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
881
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
882
|
+
---------------------------------------------------------------------------------------------------
|
883
|
+
HumanizeUnspecifiedYearIsoDateTest: test_should_return_a_humanized_unspecified_year_ISO_date_string
|
884
|
+
---------------------------------------------------------------------------------------------------
|
885
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
886
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
887
|
+
----------------------------------------------------------------
|
888
|
+
HumanizeDecadeTest: test_should_return_a_humanized_decade_string
|
889
|
+
----------------------------------------------------------------
|
890
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
891
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
892
|
+
----------------------------------------------------------
|
893
|
+
HumanizeSetTest: test_should_return_a_humanized_set_string
|
894
|
+
----------------------------------------------------------
|
895
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
896
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
897
|
+
-------------------------------------------------------------------------------------------
|
898
|
+
HumanizeApproximateIntervalTest: test_should_return_a_humanized_approximate_interval_string
|
899
|
+
-------------------------------------------------------------------------------------------
|
900
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
901
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
902
|
+
------------------------------------------------------------------
|
903
|
+
HumanizeUnknownTest: test_should_return_a_humanized_unknown_string
|
904
|
+
------------------------------------------------------------------
|
905
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
906
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
907
|
+
----------------------------
|
908
|
+
EdtfHumanizeTest: test_truth
|
909
|
+
----------------------------
|
910
|
+
[1m[35m (5.2ms)[0m rollback transaction
|
911
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
912
|
+
--------------------------------------------------------------------------------------
|
913
|
+
HumanizeUncertainIsoDateTest: test_should_return_a_humanized_uncertain_ISO_date_string
|
914
|
+
--------------------------------------------------------------------------------------
|
915
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
916
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
917
|
+
-------------------------------------------------------------------
|
918
|
+
HumanizeIsoDateTest: test_should_return_a_humanized_ISO_date_string
|
919
|
+
-------------------------------------------------------------------
|
920
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
921
|
+
---------------------------------------------------------------------------------------------------
|
922
|
+
HumanizeUnspecifiedYearIsoDateTest: test_should_return_a_humanized_unspecified_year_ISO_date_string
|
923
|
+
---------------------------------------------------------------------------------------------------
|
924
|
+
------------------------------------------------------------------
|
925
|
+
HumanizeUnknownTest: test_should_return_a_humanized_unknown_string
|
926
|
+
------------------------------------------------------------------
|
927
|
+
-------------------------------------------------------------------
|
928
|
+
HumanizeIsoDateTest: test_should_return_a_humanized_ISO_date_string
|
929
|
+
-------------------------------------------------------------------
|
930
|
+
----------------------------
|
931
|
+
EdtfHumanizeTest: test_truth
|
932
|
+
----------------------------
|
933
|
+
----------------------------------------------------------
|
934
|
+
HumanizeSetTest: test_should_return_a_humanized_set_string
|
935
|
+
----------------------------------------------------------
|
936
|
+
-------------------------------------------------------------------------------------------
|
937
|
+
HumanizeApproximateIntervalTest: test_should_return_a_humanized_approximate_interval_string
|
938
|
+
-------------------------------------------------------------------------------------------
|
939
|
+
----------------------------------------------------------------
|
940
|
+
HumanizeSeasonTest: test_should_return_a_humanized_season_string
|
941
|
+
----------------------------------------------------------------
|
942
|
+
--------------------------------------------------------------------------------------
|
943
|
+
HumanizeUncertainIsoDateTest: test_should_return_a_humanized_uncertain_ISO_date_string
|
944
|
+
--------------------------------------------------------------------------------------
|
945
|
+
----------------------------------------------------------------
|
946
|
+
HumanizeDecadeTest: test_should_return_a_humanized_decade_string
|
947
|
+
----------------------------------------------------------------
|
948
|
+
------------------------------------------------------------------
|
949
|
+
HumanizeCenturyTest: test_should_return_a_humanized_century_string
|
950
|
+
------------------------------------------------------------------
|
951
|
+
--------------------------------------------------------------------
|
952
|
+
HumanizeIntervalTest: test_should_return_a_humanized_interval_string
|
953
|
+
--------------------------------------------------------------------
|
954
|
+
----------------------------
|
955
|
+
EdtfHumanizeTest: test_truth
|
956
|
+
----------------------------
|
957
|
+
----------------------------------------------------------
|
958
|
+
HumanizeSetTest: test_should_return_a_humanized_set_string
|
959
|
+
----------------------------------------------------------
|
960
|
+
----------------------------------------------------------------
|
961
|
+
HumanizeDecadeTest: test_should_return_a_humanized_decade_string
|
962
|
+
----------------------------------------------------------------
|
963
|
+
-------------------------------------------------------------------
|
964
|
+
HumanizeIsoDateTest: test_should_return_a_humanized_ISO_date_string
|
965
|
+
-------------------------------------------------------------------
|
966
|
+
------------------------------------------------------------------
|
967
|
+
HumanizeCenturyTest: test_should_return_a_humanized_century_string
|
968
|
+
------------------------------------------------------------------
|
969
|
+
------------------------------------------------------------------
|
970
|
+
HumanizeUnknownTest: test_should_return_a_humanized_unknown_string
|
971
|
+
------------------------------------------------------------------
|
972
|
+
--------------------------------------------------------------------------------------
|
973
|
+
HumanizeUncertainIsoDateTest: test_should_return_a_humanized_uncertain_ISO_date_string
|
974
|
+
--------------------------------------------------------------------------------------
|
975
|
+
----------------------------------------------------------------
|
976
|
+
HumanizeSeasonTest: test_should_return_a_humanized_season_string
|
977
|
+
----------------------------------------------------------------
|
978
|
+
-------------------------------------------------------------------------------------------
|
979
|
+
HumanizeApproximateIntervalTest: test_should_return_a_humanized_approximate_interval_string
|
980
|
+
-------------------------------------------------------------------------------------------
|
981
|
+
---------------------------------------------------------------------------------------------------
|
982
|
+
HumanizeUnspecifiedYearIsoDateTest: test_should_return_a_humanized_unspecified_year_ISO_date_string
|
983
|
+
---------------------------------------------------------------------------------------------------
|
984
|
+
--------------------------------------------------------------------
|
985
|
+
HumanizeIntervalTest: test_should_return_a_humanized_interval_string
|
986
|
+
--------------------------------------------------------------------
|
987
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
988
|
+
------------------------------------------------------------------
|
989
|
+
HumanizeCenturyTest: test_should_return_a_humanized_century_string
|
990
|
+
------------------------------------------------------------------
|
991
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
992
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
993
|
+
-------------------------------------------------------------------
|
994
|
+
HumanizeIsoDateTest: test_should_return_a_humanized_ISO_date_string
|
995
|
+
-------------------------------------------------------------------
|
996
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
997
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
998
|
+
----------------------------------------------------------------
|
999
|
+
HumanizeDecadeTest: test_should_return_a_humanized_decade_string
|
1000
|
+
----------------------------------------------------------------
|
1001
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
1002
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
1003
|
+
----------------------------
|
1004
|
+
EdtfHumanizeTest: test_truth
|
1005
|
+
----------------------------
|
1006
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1007
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
1008
|
+
-------------------------------------------------------------------------------------------
|
1009
|
+
HumanizeApproximateIntervalTest: test_should_return_a_humanized_approximate_interval_string
|
1010
|
+
-------------------------------------------------------------------------------------------
|
1011
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
1012
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
1013
|
+
----------------------------------------------------------------
|
1014
|
+
HumanizeSeasonTest: test_should_return_a_humanized_season_string
|
1015
|
+
----------------------------------------------------------------
|
1016
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1017
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
1018
|
+
--------------------------------------------------------------------
|
1019
|
+
HumanizeIntervalTest: test_should_return_a_humanized_interval_string
|
1020
|
+
--------------------------------------------------------------------
|
1021
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
1022
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
1023
|
+
---------------------------------------------------------------------------------------------------
|
1024
|
+
HumanizeUnspecifiedYearIsoDateTest: test_should_return_a_humanized_unspecified_year_ISO_date_string
|
1025
|
+
---------------------------------------------------------------------------------------------------
|
1026
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1027
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
1028
|
+
--------------------------------------------------------------------------------------
|
1029
|
+
HumanizeUncertainIsoDateTest: test_should_return_a_humanized_uncertain_ISO_date_string
|
1030
|
+
--------------------------------------------------------------------------------------
|
1031
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1032
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
1033
|
+
----------------------------------------------------------
|
1034
|
+
HumanizeSetTest: test_should_return_a_humanized_set_string
|
1035
|
+
----------------------------------------------------------
|
1036
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
1037
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
1038
|
+
------------------------------------------------------------------
|
1039
|
+
HumanizeUnknownTest: test_should_return_a_humanized_unknown_string
|
1040
|
+
------------------------------------------------------------------
|
1041
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
data/test/test_helper.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
ENV["RAILS_ENV"] = "test"
|
3
3
|
|
4
4
|
require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
|
5
|
-
ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)]
|
5
|
+
# ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)]
|
6
6
|
require "rails/test_help"
|
7
7
|
|
8
8
|
# Filter out Minitest backtrace while allowing backtrace from other libraries
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: edtf-humanize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cory Lown
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: edtf
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '2.3'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '4'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '2.3'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '4'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: activesupport
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,20 +50,6 @@ dependencies:
|
|
44
50
|
- - "<"
|
45
51
|
- !ruby/object:Gem::Version
|
46
52
|
version: '6'
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: sqlite3
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
requirements:
|
51
|
-
- - ">="
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0'
|
54
|
-
type: :development
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
requirements:
|
58
|
-
- - ">="
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '0'
|
61
53
|
- !ruby/object:Gem::Dependency
|
62
54
|
name: rails
|
63
55
|
requirement: !ruby/object:Gem::Requirement
|