Class: RevDate

Inherits:
Object
  • Object
show all
Defined in:
lib/RevCal.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(year, month, day) ⇒ RevDate

create new RevDate with given year, month, day (numeric, using revolutionary year, month, day)



5
6
7
8
9
# File 'lib/RevCal.rb', line 5

def initialize(year, month, day)
  @year = year
  @month = month
  @day = day
end

Instance Attribute Details

#dayObject (readonly)

Returns the value of attribute day.



3
4
5
# File 'lib/RevCal.rb', line 3

def day
  @day
end

#monthObject (readonly)

Returns the value of attribute month.



3
4
5
# File 'lib/RevCal.rb', line 3

def month
  @month
end

#yearObject (readonly)

Returns the value of attribute year.



3
4
5
# File 'lib/RevCal.rb', line 3

def year
  @year
end

Class Method Details

.fromGregorian(d) ⇒ Object

convert the despised reactionary date of the ancien regime to our glorious rational format



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/RevCal.rb', line 29

def RevDate.fromGregorian(d)
  start = Date.new(1792,9,22)
  days = d - start
  year = 1
  month = 1
  while (days >= yearLen = RevDate.length(year))
    days -= yearLen
    year += 1
  end
  month = (1 + (days / 30)).to_i
  day = (1 + (days % 30)).to_i
  return RevDate.new(year, month, day)
end

.length(year) ⇒ Object

return number of days in given revolutionary year



19
20
21
22
23
24
25
26
27
# File 'lib/RevCal.rb', line 19

def RevDate.length(year)
  if (year == 3 || year == 7 || year == 11 || year == 15 || year == 20)
    return 366
  elsif (year > 20 && (year % 4 == 0 && (year % 100 > 0) || year % 400 == 0))
    return 366
  else
    return 365
  end
end

Instance Method Details

#daySymbolObject

return the date’s symbol (associated plant, animal, or tool)



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
# File 'lib/RevCal.rb', line 43

def daySymbol
  dayNum = 30*(@month - 1) + (@day - 1)
  symbols = ["Raisin (Grape)",
  "Safran (Saffron)",
  "Châtaigne (Chestnut)",
  "Colchique (Crocus)",
  "Cheval (Horse)",
  "Balsamine (Impatiens)",
  "Carotte (Carrot)",
  "Amarante (Amaranth)",
  "Panais (Parsnip)",
  "Cuve (Vat)",
  "Pomme de terre (Potato)",
  "Immortelle (Strawflower)",
  "Potiron (Calabaza)",
  "Réséda (Mignonette)",
  "Âne (Donkey)",
  "Belle de nuit (The four o’clock flower)",
  "Citrouille (Pumpkin)",
  "Sarrasin (Buckwheat)",
  "Tournesol (Sunflower)",
  "Pressoir (Wine-Press)",
  "Chanvre (Hemp)",
  "Pêche (Peach)",
  "Navet (Turnip)",
  "Amaryllis (Amaryllis)",
  "Bœuf (Cow)",
  "Aubergine (Eggplant)",
  "Piment (Chili Pepper)",
  "Tomate (Tomato)",
  "Orge (Barley)",
  "Tonneau (Barrel)",
  "Pomme (Apple)",
  "Céleri (Celery)",
  "Poire (Pear)",
  "Betterave (Beet root)",
  "Oie (Goose)",
  "Héliotrope (Heliotrope)",
  "Figue (Fig)",
  "Scorsonère (Black Salsify)",
  "Alisier (Chequer Tree)",
  "Charrue (Plough)",
  "Salsifis (Salsify)",
  "Macre (Water chestnut)",
  "Topinambour (Jerusalem Artichoke)",
  "Endive (Endive)",
  "Dindon (Turkey)",
  "Chervis (Skirret)",
  "Cresson (Watercress)",
  "Dentelaire (Leadworts)",
  "Grenade (Pomegranate)",
  "Herse (Harrow)",
  "Bacchante (Asarum baccharis)",
  "Azerole (Acerola)",
  "Garance (Madder)",
  "Orange (Orange)",
  "Faisan (Pheasant)",
  "Pistache (Pistachio)",
  "Macjonc (Tuberous pea)",
  "Coing (Quince)",
  "Cormier (Service tree)",
  "Rouleau (Roller)",
  "Raiponce (Rampion)",
  "Turneps (Turnip)",
  "Chicorée (Chicory)",
  "Nèfle (Medlar)",
  "Cochon (Pig)",
  "Mâche (Corn Salad)",
  "Chou-fleur (Cauliflower)",
  "Miel (Honey)",
  "Genièvre (Juniper)",
  "Pioche (Pickaxe)",
  "Cire (Wax)",
  "Raifort (Horseradish)",
  "Cèdre (Cedar tree)",
  "Sapin (Fir tree)",
  "Chevreuil (Roe Deer)",
  "Ajonc (Gorse)",
  "Cyprès (Cypress Tree)",
  "Lierre (Ivy)",
  "Sabine (Juniper)",
  "Hoyau (Grub-hoe)",
  "Érable sucré (Maple Tree)",
  "Bruyère (Heather)",
  "Roseau (Reed plant)",
  "Oseille (Sorrel)",
  "Grillon (Cricket)",
  "Pignon (Pinenut)",
  "Liège (cork)",
  "Truffe (Truffle)",
  "Olive (Olive)",
  "Pelle (shovel)",
  "Tourbe (Peat)",
  "Houille (Coal)",
  "Bitume (Bitumen)",
  "Soufre (Sulphur)",
  "Chien (Dog)",
  "Lave (Lava)",
  "Terre végétale (Topsoil)",
  "Fumier (Manure)",
  "Salpêtre (Saltpeter)",
  "Fléau (Flail)",
  "Granit (Granite stone)",
  "Argile (Clay)",
  "Ardoise (Slate)",
  "Grès (Sandstone)",
  "Lapin (Rabbit)",
  "Silex (Flint)",
  "Marne (Marl)",
  "Pierre à chaux (Limestone)",
  "Marbre (Marble)",
  "Van (Winnowing basket)",
  "Pierre à plâtre (Gypsum)",
  "Sel (Salt)",
  "Fer (Iron)",
  "Cuivre (Copper)",
  "Chat (Cat)",
  "Étain (Tin)",
  "Plomb (Lead)",
  "Zinc (Zinc)",
  "Mercure (Mercury (metal))",
  "Crible (Sieve)",
  "Lauréole (Spurge-laurel)",
  "Mousse (Moss)",
  "Fragon (Butcher’s Broom)",
  "Perce-neige (Snowdrop)",
  "Taureau (Bull)",
  "Laurier-thym (Laurustinus)",
  "Amadouvier (Tinder polypore)",
  "Mézéréon (Daphne mezereum)",
  "Peuplier (Poplar Tree)",
  "Coignée (Axe)",
  "Ellébore (Hellebore)",
  "Brocoli (Broccoli)",
  "Laurier (Laurel)",
  "Avelinier (Cob or filbert)",
  "Vache (Cow)",
  "Buis (Box Tree)",
  "Lichen (Lichen)",
  "If (Yew tree)",
  "Pulmonaire (Lungwort)",
  "Serpette (Billhook)",
  "Thlaspi (Pennycress)",
  "Thimelé (Rose Daphne)",
  "Chiendent (Couch Grass)",
  "Trainasse (Knotweed)",
  "Lièvre (Hare)",
  "Guède (Woad)",
  "Noisetier (Hazel)",
  "Cyclamen (Cyclamen)",
  "Chélidoine (Celandine)",
  "Traîneau (Sleigh)",
  "Tussilage (Coltsfoot)",
  "Cornouiller (Dogwood)",
  "Violier (Matthiola)",
  "Troène (Privet)",
  "Bouc (Billygoat)",
  "Asaret (Wild Ginger)",
  "Alaterne (Buckthorn)",
  "Violette (Violet (plant))",
  "Marceau (Goat Willow)",
  "Bêche (Spade)",
  "Narcisse (Narcissus)",
  "Orme (Elm Tree)",
  "Fumeterre (Common fumitory)",
  "Vélar (Hedge Mustard)",
  "Chèvre (Goat)",
  "Épinard (Spinach)",
  "Doronic (Large-flowered Leopard’s Bane)",
  "Mouron (Pimpernel)",
  "Cerfeuil (Chervil)",
  "Cordeau (Twine)",
  "Mandragore (Mandrake)",
  "Persil (Parsley)",
  "Cochléaria (Scurvy-grass)",
  "Pâquerette (Daisy)",
  "Thon (Tuna)",
  "Pissenlit (Dandelion)",
  "Sylve (Forest)",
  "Capillaire (Maidenhair fern)",
  "Frêne (Ash Tree)",
  "Plantoir (Dibber: a hand gardening tool)",
  "Primevère (Primrose)",
  "Platane (Plane Tree)",
  "Asperge (Asparagus)",
  "Tulipe (Tulip)",
  "Poule (Hen)",
  "Bette (Chard Plant)",
  "Bouleau (Birch Tree)",
  "Jonquille (Daffodil)",
  "Aulne (Alder)",
  "Couvoir (Hatchery)",
  "Pervenche (Periwinkle)",
  "Charme (Ironwood)",
  "Morille (Morel)",
  "Hêtre (Beech Tree)",
  "Abeille (Bee)",
  "Laitue (Lettuce)",
  "Mélèze (Larch)",
  "Ciguë (Hemlock)",
  "Radis (Radish)",
  "Ruche (Hive)",
  "Gainier (Judas tree)",
  "Romaine (Lettuce)",
  "Marronnier (Chestnut Oak)",
  "Roquette (Arugula or Rocket)",
  "Pigeon (Pigeon)",
  "Lilas (Lilac)",
  "Anémone (Anemone)",
  "Pensée (Pansy)",
  "Myrtille (Blueberry)",
  "Greffoir (Knife)",
  "Rose (Rose)",
  "Chêne (Oak Tree)",
  "Fougère (Fern)",
  "Aubépine (Hawthorn)",
  "Rossignol (Nightingale)",
  "Ancolie (Columbine)",
  "Muguet (Lily of the Valley)",
  "Champignon (Button mushroom)",
  "Hyacinthe (Hyacinth)",
  "Râteau (Rake)",
  "Rhubarbe (Rhubarb)",
  "Sainfoin (Sainfoin)",
  "Bâton-d’or (Wallflower)",
  "Chamérops (Palm tree)",
  "Ver à soie (Silkworm)",
  "Consoude (Comfrey)",
  "Pimprenelle (Salad Burnet)",
  "Corbeille d’or (Basket of Gold)",
  "Arroche (Orache)",
  "Sarcloir (Garden hoe)",
  "Statice (Sea Lavender)",
  "Fritillaire (Fritillary)",
  "Bourrache (Borage)",
  "Valériane (Valerian)",
  "Carpe (Carp)",
  "Fusain (Spindle (shrub))",
  "Civette (Chive)",
  "Buglosse (Bugloss)",
  "Sénevé (Wild mustard)",
  "Houlette (Shepherd’s crook)",
  "Luzerne (Alfalfa)",
  "Hémérocalle (Daylily)",
  "Trèfle (Clover)",
  "Angélique (Angelica)",
  "Canard (Duck)",
  "Mélisse (Lemon Balm)",
  "Fromental (Oat grass)",
  "Martagon (Martagon lily)",
  "Serpolet (Thyme plant)",
  "Faux (Scythe)",
  "Fraise (Strawberry)",
  "Bétoine (Woundwort)",
  "Pois (Pea)",
  "Acacia (Acacia)",
  "Caille (Quail)",
  "Œillet (Carnation)",
  "Sureau (Elderberry)",
  "Pavot (Poppy plant)",
  "Tilleul (Linden or Lime tree)",
  "Fourche (Pitchfork)",
  "Barbeau (Cornflower)",
  "Camomille (Camomile)",
  "Chèvrefeuille (Honeysuckle)",
  "caille-lait (Bedstraw)",
  "Tanche (Tench)",
  "Jasmin (Jasmine Plant)",
  "Verveine (Verbena)",
  "Thym (Thyme Plant)",
  "Pivoine (Peony Plant)",
  "Chariot (Hand Cart)",
  "Seigle (Rye)",
  "Avoine (Oats)",
  "Oignon (Onion)",
  "Véronique (Speedwell)",
  "Mulet (Mule)",
  "Romarin (Rosemary)",
  "Concombre (Cucumber)",
  "Échalote (Shallot)",
  "Absinthe (Wormwood)",
  "Faucille (Sickle)",
  "Coriandre (Coriander)",
  "Artichaut (Artichoke)",
  "Girofle (Clove)",
  "Lavande (Lavender)",
  "Chamois (Chamois)",
  "Tabac (Tobacco)",
  "Groseille (Currant)",
  "Gesse (Hairy Vetchling)",
  "Cerise (Cherry)",
  "Parc (Park)",
  "Menthe (Mint)",
  "Cumin (Cumin)",
  "Haricot (Bean)",
  "Orcanète (Alkanet)",
  "Pintade (Guinea fowl)",
  "Sauge (Sage Plant)",
  "Ail (Garlic)",
  "Vesce (Tare)",
  "Blé (Wheat)",
  "Chalémie (Shawm)",
  "Épeautre (Einkorn Wheat)",
  "Bouillon blanc (Common Mullein)",
  "Melon (Honeydew Melon)",
  "Ivraie (Ryegrass)",
  "Bélier (Ram)",
  "Prêle (Horsetail)",
  "Armoise (Mugwort)",
  "Carthame (Safflower)",
  "Mûre (Blackberry)",
  "Arrosoir (Watering Can)",
  "Panis (Panic grass)",
  "Salicorne (Common Glasswort)",
  "Abricot (Apricot)",
  "Basilic (Basil)",
  "Brebis (Ewe)",
  "Guimauve (Marshmallow root)",
  "Lin (Flax)",
  "Amande (Almond)",
  "Gentiane (Gentian)",
  "Écluse (Lock)",
  "Carline (Carline thistle)",
  "Câprier (Caper)",
  "Lentille (Lentil)",
  "Aunée (Yellow starwort)",
  "Loutre (Otter)",
  "Myrte (Myrtle)",
  "Colza (Rapeseed)",
  "Lupin (Lupin)",
  "Coton (Cotton)",
  "Moulin (Mill)",
  "Prune (Plum)",
  "Millet (Millet)",
  "Lycoperdon (Puffball)",
  "Escourgeon (Six-row Barley)",
  "Saumon (Salmon)",
  "Tubéreuse (Tuberose)",
  "Sucrion (Sugar melon)",
  "Apocyn (Apocynum)",
  "Réglisse (Liquorice)",
  "Échelle (Ladder)",
  "Pastèque (Watermelon)",
  "Fenouil (Fennel)",
  "Épine vinette (Barberry)",
  "Noix (Walnut)",
  "Truite (Trout)",
  "Citron (Lemon)",
  "Cardère (Teasel)",
  "Nerprun (Buckthorn)",
  "Tagette (Mexican Marigold)",
  "Hotte (Sack)",
  "Églantine (Wild Rose)",
  "Noisette (Hazelnut)",
  "Houblon (Hops)",
  "Sorgho (Sorghum)",
  "Écrevisse (Crayfish)",
  "Bigarade (Bitter Orange)",
  "Verge d’or (Goldenrod)",
  "Maïs (Maize or Corn)",
  "Marron (Chestnut)",
  "Panier (Basket)",
  "La Fête de la Vertu (Celebration of Virtue)",
  "La Fête du Génie (Celebration of Talent)",
  "La Fête du Travail (Celebration of Labour)",
  "La Fête de l'Opinion (Celebration of Principles)",
  "La Fête des Récompenses (Celebration of Honours)",
  "La Fête de la Révolution (Celebration of the Revolution)"]
  return symbols[dayNum]
end

#to_sObject

create human readable string of date



11
12
13
14
15
16
17
# File 'lib/RevCal.rb', line 11

def to_s
  names = ["Vendémiaire", "Brumaire", "Frimaire", "Nivôse", "Pluviôse",
      "Ventôse", "Germinal", "Floréal", "Prairial", "Messidor",
      "Thermidor", "Fructidor", "Sansculottides"]
  s = ""
  s += @day.to_s + " " + names[@month - 1] + " " + @year.to_s
end