edtf-humanize 0.0.3 → 0.0.4

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: 8e0e270335cf2b7abbc0422aae7201a087a0be8b
4
- data.tar.gz: bbe083a2e89d792d98d849cc68200f1ee83c2ff2
3
+ metadata.gz: f598275a9531dce2588e12032e88134a6beb0395
4
+ data.tar.gz: 8123239d6628e382e3d55dc7ccc1647a3422216a
5
5
  SHA512:
6
- metadata.gz: 44252fe461dcc101dd6bda09cc54d313a5466b295aa0dbdf140e4ffd9269f12c2541a525afe622402891367bbd8d26c4f5a08921d96fdb7c72e6f0230a585cc4
7
- data.tar.gz: a15d6d76736c69afb1c70bfca8bd3e56ae849f15c916fd3727eb4fd0821fb80252ac46d91f1d5b77ff4ae88cfd98c3f3f3ddad24ef8c92e7e7a7c1c4acde61d4
6
+ metadata.gz: 42710d68370529b5a90241e63392b0ad07e83d124d35d83d6d73d816deded6a817578ec6c5fa2dd07be69a88f03dbda77ecae648162af9887306815ed40379e7
7
+ data.tar.gz: 1885e8645447d2a3bb44668cc22be7095c3909640ccc77e4e042021b657891fc33de9c0adff9952dfeae2564a36787fc48064193b29c40796e2a8d4e129a5455
@@ -0,0 +1,12 @@
1
+ Copyright (c) 2014, Duke University
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
+
6
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
+
8
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9
+
10
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
+
12
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -9,6 +9,7 @@ module Edtf
9
9
  require 'edtf/humanize/season'
10
10
  require 'edtf/humanize/interval'
11
11
  require 'edtf/humanize/set'
12
+ require 'edtf/humanize/unknown'
12
13
  require 'edtf/humanize/iso_date'
13
14
 
14
15
  EDTF::Decade.include Edtf::Humanize::Decade
@@ -16,8 +17,10 @@ module Edtf
16
17
  EDTF::Season.include Edtf::Humanize::Season
17
18
  EDTF::Interval.include Edtf::Humanize::Interval
18
19
  EDTF::Set.include Edtf::Humanize::Set
20
+ EDTF::Unknown.include Edtf::Humanize::Unknown
19
21
  Date.include Edtf::Humanize::IsoDate
20
22
 
23
+
21
24
  def self.configuration
22
25
  @configuration ||= Configuration.new
23
26
  end
@@ -44,7 +47,8 @@ module Edtf
44
47
  :set_dates_connector,
45
48
  :set_last_date_connector,
46
49
  :set_two_dates_connector,
47
- :interval_unspecified_suffix
50
+ :interval_unspecified_suffix,
51
+ :unknown
48
52
 
49
53
  def initialize
50
54
  @day_precision_strftime_format = "%B %-d, %Y"
@@ -66,6 +70,8 @@ module Edtf
66
70
  @set_dates_connector = ", "
67
71
  @set_last_date_connector = " or "
68
72
  @set_two_dates_connector = " or "
73
+
74
+ @unknown = "unknown"
69
75
  end
70
76
 
71
77
  end
@@ -0,0 +1,11 @@
1
+ module Edtf
2
+ module Humanize
3
+ module Unknown
4
+
5
+ def humanize
6
+ Edtf::Humanize.configuration.unknown
7
+ end
8
+
9
+ end
10
+ end
11
+ end
@@ -1,5 +1,5 @@
1
1
  module Edtf
2
2
  module Humanize
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
@@ -538,3 +538,328 @@ HumanizeSetTest: test_should_return_a_humanized_set_string
538
538
  HumanizeDecadeTest: test_should_return_a_humanized_decade_string
539
539
  ----------------------------------------------------------------
540
540
   (0.0ms) rollback transaction
541
+  (0.1ms) begin transaction
542
+ --------------------------------------------------------------------------------------
543
+ HumanizeUncertainIsoDateTest: test_should_return_a_humanized_uncertain_ISO_date_string
544
+ --------------------------------------------------------------------------------------
545
+  (0.1ms) rollback transaction
546
+  (0.0ms) begin transaction
547
+ ----------------------------------------------------------------
548
+ HumanizeDecadeTest: test_should_return_a_humanized_decade_string
549
+ ----------------------------------------------------------------
550
+  (0.1ms) rollback transaction
551
+  (0.0ms) begin transaction
552
+ ----------------------------------------------------------------
553
+ HumanizeSeasonTest: test_should_return_a_humanized_season_string
554
+ ----------------------------------------------------------------
555
+  (0.0ms) rollback transaction
556
+  (0.1ms) begin transaction
557
+ -------------------------------------------------------------------------------------------
558
+ HumanizeApproximateIntervalTest: test_should_return_a_humanized_approximate_interval_string
559
+ -------------------------------------------------------------------------------------------
560
+  (0.0ms) rollback transaction
561
+  (0.0ms) begin transaction
562
+ ----------------------------------------------------------
563
+ HumanizeSetTest: test_should_return_a_humanized_set_string
564
+ ----------------------------------------------------------
565
+  (0.1ms) rollback transaction
566
+  (0.1ms) begin transaction
567
+ ------------------------------------------------------------------
568
+ HumanizeCenturyTest: test_should_return_a_humanized_century_string
569
+ ------------------------------------------------------------------
570
+  (0.0ms) rollback transaction
571
+  (0.0ms) begin transaction
572
+ ---------------------------------------------------------------------------------------------------
573
+ HumanizeUnspecifiedYearIsoDateTest: test_should_return_a_humanized_unspecified_year_ISO_date_string
574
+ ---------------------------------------------------------------------------------------------------
575
+  (0.0ms) rollback transaction
576
+  (0.0ms) begin transaction
577
+ --------------------------------------------------------------------
578
+ HumanizeIntervalTest: test_should_return_a_humanized_interval_string
579
+ --------------------------------------------------------------------
580
+  (0.0ms) rollback transaction
581
+  (0.0ms) begin transaction
582
+ ----------------------------
583
+ EdtfHumanizeTest: test_truth
584
+ ----------------------------
585
+  (0.0ms) rollback transaction
586
+  (0.1ms) begin transaction
587
+ -------------------------------------------------------------------
588
+ HumanizeIsoDateTest: test_should_return_a_humanized_ISO_date_string
589
+ -------------------------------------------------------------------
590
+  (0.0ms) rollback transaction
591
+  (0.1ms) begin transaction
592
+ ----------------------------------------------------------------
593
+ HumanizeDecadeTest: test_should_return_a_humanized_decade_string
594
+ ----------------------------------------------------------------
595
+  (0.1ms) rollback transaction
596
+  (0.0ms) begin transaction
597
+ --------------------------------------------------------------------
598
+ HumanizeIntervalTest: test_should_return_a_humanized_interval_string
599
+ --------------------------------------------------------------------
600
+  (0.0ms) rollback transaction
601
+  (0.0ms) begin transaction
602
+ -------------------------------------------------------------------
603
+ HumanizeIsoDateTest: test_should_return_a_humanized_ISO_date_string
604
+ -------------------------------------------------------------------
605
+  (0.0ms) rollback transaction
606
+  (0.1ms) begin transaction
607
+ ----------------------------------------------------------
608
+ HumanizeSetTest: test_should_return_a_humanized_set_string
609
+ ----------------------------------------------------------
610
+  (0.0ms) rollback transaction
611
+  (0.1ms) begin transaction
612
+ ----------------------------------------------------------------
613
+ HumanizeSeasonTest: test_should_return_a_humanized_season_string
614
+ ----------------------------------------------------------------
615
+  (0.0ms) rollback transaction
616
+  (0.0ms) begin transaction
617
+ ------------------------------------------------------------------
618
+ HumanizeCenturyTest: test_should_return_a_humanized_century_string
619
+ ------------------------------------------------------------------
620
+  (0.0ms) rollback transaction
621
+  (0.0ms) begin transaction
622
+ ------------------------------------------------------------------
623
+ HumanizeUnknownTest: test_should_return_a_humanized_unknown_string
624
+ ------------------------------------------------------------------
625
+  (0.0ms) rollback transaction
626
+  (0.0ms) begin transaction
627
+ ---------------------------------------------------------------------------------------------------
628
+ HumanizeUnspecifiedYearIsoDateTest: test_should_return_a_humanized_unspecified_year_ISO_date_string
629
+ ---------------------------------------------------------------------------------------------------
630
+  (0.0ms) rollback transaction
631
+  (0.0ms) begin transaction
632
+ -------------------------------------------------------------------------------------------
633
+ HumanizeApproximateIntervalTest: test_should_return_a_humanized_approximate_interval_string
634
+ -------------------------------------------------------------------------------------------
635
+  (0.1ms) rollback transaction
636
+  (0.0ms) begin transaction
637
+ --------------------------------------------------------------------------------------
638
+ HumanizeUncertainIsoDateTest: test_should_return_a_humanized_uncertain_ISO_date_string
639
+ --------------------------------------------------------------------------------------
640
+  (0.1ms) rollback transaction
641
+  (0.1ms) begin transaction
642
+ ----------------------------
643
+ EdtfHumanizeTest: test_truth
644
+ ----------------------------
645
+  (0.0ms) rollback transaction
646
+  (0.1ms) begin transaction
647
+ --------------------------------------------------------------------
648
+ HumanizeIntervalTest: test_should_return_a_humanized_interval_string
649
+ --------------------------------------------------------------------
650
+  (0.0ms) rollback transaction
651
+  (0.0ms) begin transaction
652
+ ------------------------------------------------------------------
653
+ HumanizeUnknownTest: test_should_return_a_humanized_unknown_string
654
+ ------------------------------------------------------------------
655
+  (0.1ms) rollback transaction
656
+  (0.0ms) begin transaction
657
+ ----------------------------
658
+ EdtfHumanizeTest: test_truth
659
+ ----------------------------
660
+  (0.0ms) rollback transaction
661
+  (0.0ms) begin transaction
662
+ -------------------------------------------------------------------
663
+ HumanizeIsoDateTest: test_should_return_a_humanized_ISO_date_string
664
+ -------------------------------------------------------------------
665
+  (0.0ms) rollback transaction
666
+  (0.0ms) begin transaction
667
+ ----------------------------------------------------------------
668
+ HumanizeSeasonTest: test_should_return_a_humanized_season_string
669
+ ----------------------------------------------------------------
670
+  (0.0ms) rollback transaction
671
+  (0.0ms) begin transaction
672
+ --------------------------------------------------------------------------------------
673
+ HumanizeUncertainIsoDateTest: test_should_return_a_humanized_uncertain_ISO_date_string
674
+ --------------------------------------------------------------------------------------
675
+  (0.0ms) rollback transaction
676
+  (0.0ms) begin transaction
677
+ ------------------------------------------------------------------
678
+ HumanizeCenturyTest: test_should_return_a_humanized_century_string
679
+ ------------------------------------------------------------------
680
+  (0.1ms) rollback transaction
681
+  (0.0ms) begin transaction
682
+ ---------------------------------------------------------------------------------------------------
683
+ HumanizeUnspecifiedYearIsoDateTest: test_should_return_a_humanized_unspecified_year_ISO_date_string
684
+ ---------------------------------------------------------------------------------------------------
685
+  (0.1ms) rollback transaction
686
+  (0.0ms) begin transaction
687
+ ----------------------------------------------------------
688
+ HumanizeSetTest: test_should_return_a_humanized_set_string
689
+ ----------------------------------------------------------
690
+  (0.1ms) rollback transaction
691
+  (0.0ms) begin transaction
692
+ -------------------------------------------------------------------------------------------
693
+ HumanizeApproximateIntervalTest: test_should_return_a_humanized_approximate_interval_string
694
+ -------------------------------------------------------------------------------------------
695
+  (0.0ms) rollback transaction
696
+  (0.0ms) begin transaction
697
+ ----------------------------------------------------------------
698
+ HumanizeDecadeTest: test_should_return_a_humanized_decade_string
699
+ ----------------------------------------------------------------
700
+  (0.0ms) rollback transaction
701
+  (0.1ms) begin transaction
702
+ ----------------------------------------------------------
703
+ HumanizeSetTest: test_should_return_a_humanized_set_string
704
+ ----------------------------------------------------------
705
+  (0.1ms) rollback transaction
706
+  (0.0ms) begin transaction
707
+ ------------------------------------------------------------------
708
+ HumanizeCenturyTest: test_should_return_a_humanized_century_string
709
+ ------------------------------------------------------------------
710
+  (0.0ms) rollback transaction
711
+  (0.0ms) begin transaction
712
+ --------------------------------------------------------------------
713
+ HumanizeIntervalTest: test_should_return_a_humanized_interval_string
714
+ --------------------------------------------------------------------
715
+  (0.0ms) rollback transaction
716
+  (0.0ms) begin transaction
717
+ ----------------------------------------------------------------
718
+ HumanizeSeasonTest: test_should_return_a_humanized_season_string
719
+ ----------------------------------------------------------------
720
+  (0.1ms) rollback transaction
721
+  (0.0ms) begin transaction
722
+ ---------------------------------------------------------------------------------------------------
723
+ HumanizeUnspecifiedYearIsoDateTest: test_should_return_a_humanized_unspecified_year_ISO_date_string
724
+ ---------------------------------------------------------------------------------------------------
725
+  (0.0ms) rollback transaction
726
+  (0.0ms) begin transaction
727
+ ----------------------------
728
+ EdtfHumanizeTest: test_truth
729
+ ----------------------------
730
+  (0.0ms) rollback transaction
731
+  (0.0ms) begin transaction
732
+ --------------------------------------------------------------------------------------
733
+ HumanizeUncertainIsoDateTest: test_should_return_a_humanized_uncertain_ISO_date_string
734
+ --------------------------------------------------------------------------------------
735
+  (0.0ms) rollback transaction
736
+  (0.0ms) begin transaction
737
+ ------------------------------------------------------------------
738
+ HumanizeUnknownTest: test_should_return_a_humanized_unknown_string
739
+ ------------------------------------------------------------------
740
+  (0.1ms) rollback transaction
741
+  (0.0ms) begin transaction
742
+ -------------------------------------------------------------------
743
+ HumanizeIsoDateTest: test_should_return_a_humanized_ISO_date_string
744
+ -------------------------------------------------------------------
745
+  (0.0ms) rollback transaction
746
+  (0.0ms) begin transaction
747
+ -------------------------------------------------------------------------------------------
748
+ HumanizeApproximateIntervalTest: test_should_return_a_humanized_approximate_interval_string
749
+ -------------------------------------------------------------------------------------------
750
+  (0.1ms) rollback transaction
751
+  (0.0ms) begin transaction
752
+ ----------------------------------------------------------------
753
+ HumanizeDecadeTest: test_should_return_a_humanized_decade_string
754
+ ----------------------------------------------------------------
755
+  (0.0ms) rollback transaction
756
+  (0.1ms) begin transaction
757
+ --------------------------------------------------------------------
758
+ HumanizeIntervalTest: test_should_return_a_humanized_interval_string
759
+ --------------------------------------------------------------------
760
+  (0.1ms) rollback transaction
761
+  (0.0ms) begin transaction
762
+ -------------------------------------------------------------------------------------------
763
+ HumanizeApproximateIntervalTest: test_should_return_a_humanized_approximate_interval_string
764
+ -------------------------------------------------------------------------------------------
765
+  (0.0ms) rollback transaction
766
+  (0.0ms) begin transaction
767
+ ------------------------------------------------------------------
768
+ HumanizeCenturyTest: test_should_return_a_humanized_century_string
769
+ ------------------------------------------------------------------
770
+  (0.0ms) rollback transaction
771
+  (0.0ms) begin transaction
772
+ --------------------------------------------------------------------------------------
773
+ HumanizeUncertainIsoDateTest: test_should_return_a_humanized_uncertain_ISO_date_string
774
+ --------------------------------------------------------------------------------------
775
+  (0.0ms) rollback transaction
776
+  (0.0ms) begin transaction
777
+ -------------------------------------------------------------------
778
+ HumanizeIsoDateTest: test_should_return_a_humanized_ISO_date_string
779
+ -------------------------------------------------------------------
780
+  (0.1ms) rollback transaction
781
+  (0.0ms) begin transaction
782
+ ------------------------------------------------------------------
783
+ HumanizeUnknownTest: test_should_return_a_humanized_unknown_string
784
+ ------------------------------------------------------------------
785
+  (0.0ms) rollback transaction
786
+  (0.0ms) begin transaction
787
+ ----------------------------------------------------------------
788
+ HumanizeSeasonTest: test_should_return_a_humanized_season_string
789
+ ----------------------------------------------------------------
790
+  (0.1ms) rollback transaction
791
+  (0.0ms) begin transaction
792
+ ----------------------------
793
+ EdtfHumanizeTest: test_truth
794
+ ----------------------------
795
+  (0.0ms) rollback transaction
796
+  (0.0ms) begin transaction
797
+ ----------------------------------------------------------
798
+ HumanizeSetTest: test_should_return_a_humanized_set_string
799
+ ----------------------------------------------------------
800
+  (0.0ms) rollback transaction
801
+  (0.0ms) begin transaction
802
+ ----------------------------------------------------------------
803
+ HumanizeDecadeTest: test_should_return_a_humanized_decade_string
804
+ ----------------------------------------------------------------
805
+  (0.0ms) rollback transaction
806
+  (0.0ms) begin transaction
807
+ ---------------------------------------------------------------------------------------------------
808
+ HumanizeUnspecifiedYearIsoDateTest: test_should_return_a_humanized_unspecified_year_ISO_date_string
809
+ ---------------------------------------------------------------------------------------------------
810
+  (0.0ms) rollback transaction
811
+  (0.1ms) begin transaction
812
+ ---------------------------------------------------------------------------------------------------
813
+ HumanizeUnspecifiedYearIsoDateTest: test_should_return_a_humanized_unspecified_year_ISO_date_string
814
+ ---------------------------------------------------------------------------------------------------
815
+  (0.0ms) rollback transaction
816
+  (0.0ms) begin transaction
817
+ -------------------------------------------------------------------
818
+ HumanizeIsoDateTest: test_should_return_a_humanized_ISO_date_string
819
+ -------------------------------------------------------------------
820
+  (0.0ms) rollback transaction
821
+  (0.0ms) begin transaction
822
+ ------------------------------------------------------------------
823
+ HumanizeUnknownTest: test_should_return_a_humanized_unknown_string
824
+ ------------------------------------------------------------------
825
+  (0.0ms) rollback transaction
826
+  (0.0ms) begin transaction
827
+ ----------------------------
828
+ EdtfHumanizeTest: test_truth
829
+ ----------------------------
830
+  (0.0ms) rollback transaction
831
+  (0.0ms) begin transaction
832
+ ----------------------------------------------------------------
833
+ HumanizeSeasonTest: test_should_return_a_humanized_season_string
834
+ ----------------------------------------------------------------
835
+  (0.0ms) rollback transaction
836
+  (0.0ms) begin transaction
837
+ --------------------------------------------------------------------
838
+ HumanizeIntervalTest: test_should_return_a_humanized_interval_string
839
+ --------------------------------------------------------------------
840
+  (0.0ms) rollback transaction
841
+  (0.0ms) begin transaction
842
+ ------------------------------------------------------------------
843
+ HumanizeCenturyTest: test_should_return_a_humanized_century_string
844
+ ------------------------------------------------------------------
845
+  (0.0ms) rollback transaction
846
+  (0.1ms) begin transaction
847
+ --------------------------------------------------------------------------------------
848
+ HumanizeUncertainIsoDateTest: test_should_return_a_humanized_uncertain_ISO_date_string
849
+ --------------------------------------------------------------------------------------
850
+  (0.0ms) rollback transaction
851
+  (0.0ms) begin transaction
852
+ ----------------------------------------------------------------
853
+ HumanizeDecadeTest: test_should_return_a_humanized_decade_string
854
+ ----------------------------------------------------------------
855
+  (0.0ms) rollback transaction
856
+  (0.0ms) begin transaction
857
+ ----------------------------------------------------------
858
+ HumanizeSetTest: test_should_return_a_humanized_set_string
859
+ ----------------------------------------------------------
860
+  (0.0ms) rollback transaction
861
+  (0.0ms) begin transaction
862
+ -------------------------------------------------------------------------------------------
863
+ HumanizeApproximateIntervalTest: test_should_return_a_humanized_approximate_interval_string
864
+ -------------------------------------------------------------------------------------------
865
+  (0.0ms) rollback transaction
@@ -68,3 +68,11 @@ class HumanizeSetTest < ActiveSupport::TestCase
68
68
  assert_equal "1980, 1981 or 1983", d.humanize
69
69
  end
70
70
  end
71
+
72
+ class HumanizeUnknownTest < ActiveSupport::TestCase
73
+ test "should return a humanized unknown string" do
74
+ d = Date.edtf('uuuu')
75
+ assert_equal "unknown", d.humanize
76
+ end
77
+ end
78
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: edtf-humanize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
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-04-21 00:00:00.000000000 Z
11
+ date: 2016-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -53,13 +53,14 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  description: This gem adds a humanize method to EDTF::Decade, EDTF::Interval, EDTF::Set,
56
- EDTF::Season, and Date (ISO 8601 compliant) objects.
56
+ EDTF::Season, EDTF::Unknown, and Date (ISO 8601 compliant) objects.
57
57
  email:
58
58
  - cory.lown@duke.edu
59
59
  executables: []
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
+ - LICENSE.txt
63
64
  - Rakefile
64
65
  - lib/edtf-humanize.rb
65
66
  - lib/edtf/humanize.rb
@@ -70,6 +71,7 @@ files:
70
71
  - lib/edtf/humanize/iso_date.rb
71
72
  - lib/edtf/humanize/season.rb
72
73
  - lib/edtf/humanize/set.rb
74
+ - lib/edtf/humanize/unknown.rb
73
75
  - lib/edtf/humanize/version.rb
74
76
  - lib/tasks/edtf_humanize_tasks.rake
75
77
  - test/dummy/README.rdoc