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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ca4afd67f78503900311e3cd852ae9ee59a94710
4
- data.tar.gz: f3440398bac5c838fdce163fd66bad1f68ed0443
3
+ metadata.gz: 5ee4450eeb42029edd41bbb6b58dd24e66ae1fd8
4
+ data.tar.gz: 1491fe02881b157527af1121d6a9fffddf461e49
5
5
  SHA512:
6
- metadata.gz: 1e5fac118d56ffc03fca59f928149ec04c1a0ceb56600860b2aa171333b075c17d6b54ef7375c33eb929489340071c8b5e9b66e517d44e9a1ffb5cfd398e4e68
7
- data.tar.gz: 8102964632e73d8d389e4e14f0634f9598f5d7b453dcea957c89f04b80562d23e0b4b1250bf2e8d9c5a23e9a76c39b641be98b379a46540c271b54b6384067c0
6
+ metadata.gz: 18462c0ce9aa3cd1919666f421cf8da6b059cceb931a1d37f578286eaaf430b80c7dd5dfc1a3989279eb31554d32b4849e8464cf88493dd3403a88dc7aa20d78
7
+ data.tar.gz: bb7833b4a6c7586b3f0b8e73d436ef4dd5b1f395f9f0f8380c5e95abf5f7ad3ea995271a67d50585ea2dc0de5663c63bfd872cb7f8603caacd1b65decf534283
@@ -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
@@ -3,7 +3,7 @@ module Edtf
3
3
  module Century
4
4
 
5
5
  include Edtf::Humanize::Formats
6
-
6
+
7
7
  def humanize
8
8
  "#{self.begin.year}#{Edtf::Humanize.configuration.century_suffix}"
9
9
  end
@@ -3,7 +3,7 @@ module Edtf
3
3
  module Decade
4
4
 
5
5
  include Edtf::Humanize::Formats
6
-
6
+
7
7
  def humanize
8
8
  "#{self.begin.year}#{Edtf::Humanize.configuration.decade_suffix}"
9
9
  end
@@ -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)
@@ -5,15 +5,17 @@ module Edtf
5
5
  include Edtf::Humanize::Formats
6
6
 
7
7
  def humanize
8
- display = []
9
- self.entries.each do |date|
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,5 +1,5 @@
1
1
  module Edtf
2
2
  module Humanize
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
@@ -1,6 +1,12 @@
1
1
  require File.expand_path('../boot', __FILE__)
2
2
 
3
- require 'rails/all'
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
@@ -75,5 +75,5 @@ Rails.application.configure do
75
75
  config.log_formatter = ::Logger::Formatter.new
76
76
 
77
77
  # Do not dump schema after migrations.
78
- config.active_record.dump_schema_after_migration = false
78
+ # config.active_record.dump_schema_after_migration = false
79
79
  end
@@ -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
   (0.0ms) rollback transaction
866
+  (0.1ms) begin transaction
867
+ --------------------------------------------------------------------
868
+ HumanizeIntervalTest: test_should_return_a_humanized_interval_string
869
+ --------------------------------------------------------------------
870
+  (0.1ms) rollback transaction
871
+  (0.1ms) begin transaction
872
+ ----------------------------------------------------------------
873
+ HumanizeSeasonTest: test_should_return_a_humanized_season_string
874
+ ----------------------------------------------------------------
875
+  (0.0ms) rollback transaction
876
+  (0.1ms) begin transaction
877
+ ------------------------------------------------------------------
878
+ HumanizeCenturyTest: test_should_return_a_humanized_century_string
879
+ ------------------------------------------------------------------
880
+  (0.1ms) rollback transaction
881
+  (0.1ms) begin transaction
882
+ ---------------------------------------------------------------------------------------------------
883
+ HumanizeUnspecifiedYearIsoDateTest: test_should_return_a_humanized_unspecified_year_ISO_date_string
884
+ ---------------------------------------------------------------------------------------------------
885
+  (0.0ms) rollback transaction
886
+  (0.1ms) begin transaction
887
+ ----------------------------------------------------------------
888
+ HumanizeDecadeTest: test_should_return_a_humanized_decade_string
889
+ ----------------------------------------------------------------
890
+  (0.1ms) rollback transaction
891
+  (0.1ms) begin transaction
892
+ ----------------------------------------------------------
893
+ HumanizeSetTest: test_should_return_a_humanized_set_string
894
+ ----------------------------------------------------------
895
+  (0.1ms) rollback transaction
896
+  (0.1ms) begin transaction
897
+ -------------------------------------------------------------------------------------------
898
+ HumanizeApproximateIntervalTest: test_should_return_a_humanized_approximate_interval_string
899
+ -------------------------------------------------------------------------------------------
900
+  (0.1ms) rollback transaction
901
+  (0.1ms) begin transaction
902
+ ------------------------------------------------------------------
903
+ HumanizeUnknownTest: test_should_return_a_humanized_unknown_string
904
+ ------------------------------------------------------------------
905
+  (0.0ms) rollback transaction
906
+  (0.1ms) begin transaction
907
+ ----------------------------
908
+ EdtfHumanizeTest: test_truth
909
+ ----------------------------
910
+  (5.2ms) rollback transaction
911
+  (0.1ms) begin transaction
912
+ --------------------------------------------------------------------------------------
913
+ HumanizeUncertainIsoDateTest: test_should_return_a_humanized_uncertain_ISO_date_string
914
+ --------------------------------------------------------------------------------------
915
+  (0.0ms) rollback transaction
916
+  (0.1ms) begin transaction
917
+ -------------------------------------------------------------------
918
+ HumanizeIsoDateTest: test_should_return_a_humanized_ISO_date_string
919
+ -------------------------------------------------------------------
920
+  (0.1ms) 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
+  (0.1ms) begin transaction
988
+ ------------------------------------------------------------------
989
+ HumanizeCenturyTest: test_should_return_a_humanized_century_string
990
+ ------------------------------------------------------------------
991
+  (0.1ms) rollback transaction
992
+  (0.1ms) begin transaction
993
+ -------------------------------------------------------------------
994
+ HumanizeIsoDateTest: test_should_return_a_humanized_ISO_date_string
995
+ -------------------------------------------------------------------
996
+  (0.0ms) rollback transaction
997
+  (0.1ms) begin transaction
998
+ ----------------------------------------------------------------
999
+ HumanizeDecadeTest: test_should_return_a_humanized_decade_string
1000
+ ----------------------------------------------------------------
1001
+  (0.1ms) rollback transaction
1002
+  (0.1ms) begin transaction
1003
+ ----------------------------
1004
+ EdtfHumanizeTest: test_truth
1005
+ ----------------------------
1006
+  (0.0ms) rollback transaction
1007
+  (0.1ms) begin transaction
1008
+ -------------------------------------------------------------------------------------------
1009
+ HumanizeApproximateIntervalTest: test_should_return_a_humanized_approximate_interval_string
1010
+ -------------------------------------------------------------------------------------------
1011
+  (0.1ms) rollback transaction
1012
+  (0.1ms) begin transaction
1013
+ ----------------------------------------------------------------
1014
+ HumanizeSeasonTest: test_should_return_a_humanized_season_string
1015
+ ----------------------------------------------------------------
1016
+  (0.0ms) rollback transaction
1017
+  (0.1ms) begin transaction
1018
+ --------------------------------------------------------------------
1019
+ HumanizeIntervalTest: test_should_return_a_humanized_interval_string
1020
+ --------------------------------------------------------------------
1021
+  (0.1ms) rollback transaction
1022
+  (0.1ms) begin transaction
1023
+ ---------------------------------------------------------------------------------------------------
1024
+ HumanizeUnspecifiedYearIsoDateTest: test_should_return_a_humanized_unspecified_year_ISO_date_string
1025
+ ---------------------------------------------------------------------------------------------------
1026
+  (0.0ms) rollback transaction
1027
+  (0.1ms) begin transaction
1028
+ --------------------------------------------------------------------------------------
1029
+ HumanizeUncertainIsoDateTest: test_should_return_a_humanized_uncertain_ISO_date_string
1030
+ --------------------------------------------------------------------------------------
1031
+  (0.0ms) rollback transaction
1032
+  (0.1ms) begin transaction
1033
+ ----------------------------------------------------------
1034
+ HumanizeSetTest: test_should_return_a_humanized_set_string
1035
+ ----------------------------------------------------------
1036
+  (0.1ms) rollback transaction
1037
+  (0.1ms) begin transaction
1038
+ ------------------------------------------------------------------
1039
+ HumanizeUnknownTest: test_should_return_a_humanized_unknown_string
1040
+ ------------------------------------------------------------------
1041
+  (0.0ms) rollback transaction
@@ -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.5
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-07-18 00:00:00.000000000 Z
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