File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ class Entity < ModelPart
2525 'city' ,
2626 'country' ,
2727 'email' ,
28+ 'date-end' ,
29+ 'date-start' ,
2830 'fax' ,
2931 'location' ,
3032 'name' ,
@@ -48,5 +50,31 @@ def initialize(param)
4850 end
4951 end
5052
53+ # :call-seq:
54+ # date_end = date
55+ #
56+ # Set the `date-end` field. If a non-Date object is passed in it will
57+ # be parsed into a Date.
58+ def date_end = ( date )
59+ unless Date === date
60+ date = Date . parse ( date )
61+ end
62+
63+ @fields [ 'date-end' ] = date
64+ end
65+
66+ # :call-seq:
67+ # date_start = date
68+ #
69+ # Set the `date-start` field. If a non-Date object is passed in it will
70+ # be parsed into a Date.
71+ def date_start = ( date )
72+ unless Date === date
73+ date = Date . parse ( date )
74+ end
75+
76+ @fields [ 'date-start' ] = date
77+ end
78+
5179 end
5280end
Original file line number Diff line number Diff line change @@ -57,6 +57,20 @@ def test_simple_fields_set_and_output_correctly
5757 end
5858 end
5959
60+ def test_date_fields_set_and_output_correctly
61+ date = Date . today
62+ @entity . date_end = date
63+ @entity . date_start = date
64+
65+ assert_equal @entity . date_end , date
66+ assert_equal @entity . date_start , date
67+
68+ y = @entity . fields . to_yaml
69+
70+ assert y . include? "date-end: #{ date . to_s } \n "
71+ assert y . include? "date-start: #{ date . to_s } \n "
72+ end
73+
6074 def test_tel_fax_fields_set_and_output_correctly
6175 number = "+44 (0) 161-234-5678"
6276 @entity . fax = number
You can’t perform that action at this time.
0 commit comments