Class: Code::Object::Date

Inherits:
Code::Object show all
Defined in:
lib/code/object/date.rb

Constant Summary collapse

DEFAULT_ZONE =
"Etc/UTC"

Constants inherited from Code::Object

NUMBER_CLASSES

Instance Attribute Summary

Attributes included from Concerns::Shared

#methods, #raw

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Code::Object

code_new, #code_new, maybe, #name, repeat, |

Methods included from Concerns::Shared

#<=>, #==, #as_json, #code_and, #code_as_json, #code_compare, #code_deep_duplicate, #code_different, #code_duplicate, #code_equal, #code_exclamation_mark, #code_exclusive_range, #code_falsy?, code_fetch, #code_fetch, code_get, #code_get, #code_greater, #code_greater_or_equal, #code_inclusive_range, #code_inspect, #code_less, #code_less_or_equal, #code_methods, #code_name, #code_nothing?, #code_or, #code_self, #code_set, code_set, #code_something?, #code_strict_different, #code_strict_equal, #code_to_boolean, #code_to_class, #code_to_date, #code_to_decimal, #code_to_dictionary, #code_to_duration, #code_to_integer, #code_to_json, #code_to_list, #code_to_nothing, #code_to_parameter, #code_to_range, #code_to_string, #code_to_time, #code_truthy?, #eql?, #falsy?, #hash, #inspect, #multi_fetch, #nothing?, #sig, #something?, #succ, #to_code, #to_i, #to_json, #to_s, #truthy?

Constructor Details

#initialize(*args, **_kargs, &_block) ⇒ Date

Returns a new instance of Date.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/code/object/date.rb', line 62

def initialize(*args, **_kargs, &_block)
  ::Time.zone ||= DEFAULT_ZONE

  if args.first.is_a?(String) || args.first.is_a?(::String)
    self.raw = ::Date.parse(args.first.to_s)
  elsif args.first.is_a?(Time)
    self.raw = args.first.raw.to_date
  elsif args.first.is_a?(::Time)
    self.raw = args.first.to_date
  elsif args.first.is_a?(Date)
    self.raw = args.first.raw.dup
  elsif args.first.is_a?(::Date)
    self.raw = args.first.dup
  else
    self.raw = ::Date.current
  end
end

Class Method Details

.call(**args) ⇒ Object



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
# File 'lib/code/object/date.rb', line 80

def self.call(**args)
  code_operator = args.fetch(:operator, nil).to_code
  code_arguments = args.fetch(:arguments, []).to_code
  code_value = code_arguments.code_first

  case code_operator.to_s
  when "after?"
    sig(args) { (Date | Time).maybe }
    code_after?(code_value)
  when "before?"
    sig(args) { (Date | Time).maybe }
    code_before?(code_value)
  when "past?"
    sig(args)
    code_past?
  when "future?"
    sig(args)
    code_future?
  when "format"
    sig(args) { String }
    code_format(code_value)
  when "tomorrow"
    sig(args)
    code_tomorrow
  when "yesterday"
    sig(args)
    code_yesterday
  when "today"
    sig(args)
    code_today
  when "current"
    sig(args)
    code_current
  when "now"
    sig(args)
    code_now
  when "year"
    sig(args)
    code_year
  when "years"
    sig(args)
    code_years
  when "month"
    sig(args)
    code_month
  when "months"
    sig(args)
    code_months
  when "week"
    sig(args)
    code_week
  when "weeks"
    sig(args)
    code_weeks
  when "week_day"
    sig(args)
    code_week_day
  when "week_days"
    sig(args)
    code_week_days
  when "day"
    sig(args)
    code_day
  when "days"
    sig(args)
    code_days
  when "hour"
    sig(args)
    code_hour
  when "hours"
    sig(args)
    code_hours
  when "minute"
    sig(args)
    code_minute
  when "minutes"
    sig(args)
    code_minutes
  when "second"
    sig(args)
    code_second
  when "seconds"
    sig(args)
    code_seconds
  when "monday?"
    sig(args)
    code_monday?
  when "tuesday?"
    sig(args)
    code_tuesday?
  when "wednesday?"
    sig(args)
    code_wednesday?
  when "thursday?"
    sig(args)
    code_thursday?
  when "friday?"
    sig(args)
    code_friday?
  when "saturday?"
    sig(args)
    code_saturday?
  when "sunday?"
    sig(args)
    code_sunday?
  when "january?"
    sig(args)
    code_january?
  when "february?"
    sig(args)
    code_february?
  when "march?"
    sig(args)
    code_march?
  when "april?"
    sig(args)
    code_april?
  when "may?"
    sig(args)
    code_may?
  when "june?"
    sig(args)
    code_june?
  when "july?"
    sig(args)
    code_july?
  when "august?"
    sig(args)
    code_august?
  when "september?"
    sig(args)
    code_september?
  when "october?"
    sig(args)
    code_october?
  when "november?"
    sig(args)
    code_november?
  when "december?"
    sig(args)
    code_december?
  when "add"
    sig(args) do
      {
        year: (String | Integer).maybe,
        years: (String | Integer).maybe,
        month: (String | Integer).maybe,
        months: (String | Integer).maybe,
        day: (String | Integer).maybe,
        days: (String | Integer).maybe,
        week_day: (String | Integer).maybe,
        week_days: (String | Integer).maybe,
        week: (String | Integer).maybe,
        weeks: (String | Integer).maybe
      }
    end

    if code_value.nothing?
      code_add
    else
      code_add(
        year: code_value.code_get(:year),
        years: code_value.code_get(:years),
        month: code_value.code_get(:month),
        months: code_value.code_get(:months),
        day: code_value.code_get(:day),
        days: code_value.code_get(:days),
        week_day: code_value.code_get(:week_day),
        week_days: code_value.code_get(:week_days),
        week: code_value.code_get(:week),
        weeks: code_value.code_get(:weeks)
      )
    end
  when "substract"
    sig(args) do
      {
        year: (String | Integer).maybe,
        years: (String | Integer).maybe,
        month: (String | Integer).maybe,
        months: (String | Integer).maybe,
        day: (String | Integer).maybe,
        days: (String | Integer).maybe,
        week_day: (String | Integer).maybe,
        week_days: (String | Integer).maybe,
        week: (String | Integer).maybe,
        weeks: (String | Integer).maybe
      }
    end

    if code_value.nothing?
      code_substract
    else
      code_substract(
        year: code_value.code_get(:year),
        years: code_value.code_get(:years),
        month: code_value.code_get(:month),
        months: code_value.code_get(:months),
        day: code_value.code_get(:day),
        days: code_value.code_get(:days),
        week_day: code_value.code_get(:week_day),
        week_days: code_value.code_get(:week_days),
        week: code_value.code_get(:week),
        weeks: code_value.code_get(:weeks)
      )
    end
  when "change"
    sig(args) do
      {
        year: (String | Integer).maybe,
        years: (String | Integer).maybe,
        month: (String | Integer).maybe,
        months: (String | Integer).maybe,
        day: (String | Integer).maybe,
        days: (String | Integer).maybe,
        week_day: (String | Integer).maybe,
        week_days: (String | Integer).maybe,
        week: (String | Integer).maybe,
        weeks: (String | Integer).maybe
      }
    end

    if code_value.nothing?
      code_change
    else
      code_change(
        year: code_value.code_get(:year),
        years: code_value.code_get(:years),
        month: code_value.code_get(:month),
        months: code_value.code_get(:months),
        day: code_value.code_get(:day),
        days: code_value.code_get(:days),
        week_day: code_value.code_get(:week_day),
        week_days: code_value.code_get(:week_days),
        week: code_value.code_get(:week),
        weeks: code_value.code_get(:weeks)
      )
    end
  else
    super
  end
end

Instance Method Details

#call(**args) ⇒ Object



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
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
# File 'lib/code/object/date.rb', line 322

def call(**args)
  code_operator = args.fetch(:operator, nil).to_code
  code_arguments = args.fetch(:arguments, []).to_code
  code_value = code_arguments.code_first

  case code_operator.to_s
  when "after?"
    sig(args) { (Date | Time).maybe }
    code_after?(code_value)
  when "before?"
    sig(args) { (Date | Time).maybe }
    code_before?(code_value)
  when "past?"
    sig(args)
    code_past?
  when "future?"
    sig(args)
    code_future?
  when "year"
    sig(args)
    code_year
  when "years"
    sig(args)
    code_years
  when "month"
    sig(args)
    code_month
  when "months"
    sig(args)
    code_months
  when "week"
    sig(args)
    code_week
  when "weeks"
    sig(args)
    code_weeks
  when "week_day"
    sig(args)
    code_week_day
  when "week_days"
    sig(args)
    code_week_days
  when "day"
    sig(args)
    code_day
  when "days"
    sig(args)
    code_days
  when "hour"
    sig(args)
    code_hour
  when "hours"
    sig(args)
    code_hours
  when "minute"
    sig(args)
    code_minute
  when "minutes"
    sig(args)
    code_minutes
  when "second"
    sig(args)
    code_second
  when "seconds"
    sig(args)
    code_seconds
  when "monday?"
    sig(args)
    code_monday?
  when "tuesday?"
    sig(args)
    code_tuesday?
  when "wednesday?"
    sig(args)
    code_wednesday?
  when "thursday?"
    sig(args)
    code_thursday?
  when "friday?"
    sig(args)
    code_friday?
  when "saturday?"
    sig(args)
    code_saturday?
  when "sunday?"
    sig(args)
    code_sunday?
  when "format"
    sig(args) { String }
    code_format(code_value)
  when "january?"
    sig(args)
    code_january?
  when "february?"
    sig(args)
    code_february?
  when "march?"
    sig(args)
    code_march?
  when "april?"
    sig(args)
    code_april?
  when "may?"
    sig(args)
    code_may?
  when "june?"
    sig(args)
    code_june?
  when "july?"
    sig(args)
    code_july?
  when "august?"
    sig(args)
    code_august?
  when "september?"
    sig(args)
    code_september?
  when "october?"
    sig(args)
    code_october?
  when "november?"
    sig(args)
    code_november?
  when "december?"
    sig(args)
    code_december?
  when "add"
    sig(args) do
      {
        year: (String | Integer).maybe,
        years: (String | Integer).maybe,
        month: (String | Integer).maybe,
        months: (String | Integer).maybe,
        day: (String | Integer).maybe,
        days: (String | Integer).maybe,
        week_day: (String | Integer).maybe,
        week_days: (String | Integer).maybe,
        week: (String | Integer).maybe,
        weeks: (String | Integer).maybe
      }
    end

    if code_value.nothing?
      code_add
    else
      code_add(
        year: code_value.code_get(:year),
        years: code_value.code_get(:years),
        month: code_value.code_get(:month),
        months: code_value.code_get(:months),
        day: code_value.code_get(:day),
        days: code_value.code_get(:days),
        week_day: code_value.code_get(:week_day),
        week_days: code_value.code_get(:week_days),
        week: code_value.code_get(:week),
        weeks: code_value.code_get(:weeks)
      )
    end
  when "substract"
    sig(args) do
      {
        year: (String | Integer).maybe,
        years: (String | Integer).maybe,
        month: (String | Integer).maybe,
        months: (String | Integer).maybe,
        day: (String | Integer).maybe,
        days: (String | Integer).maybe,
        week_day: (String | Integer).maybe,
        week_days: (String | Integer).maybe,
        week: (String | Integer).maybe,
        weeks: (String | Integer).maybe
      }
    end

    if code_value.nothing?
      code_substract
    else
      code_substract(
        year: code_value.code_get(:year),
        years: code_value.code_get(:years),
        month: code_value.code_get(:month),
        months: code_value.code_get(:months),
        day: code_value.code_get(:day),
        days: code_value.code_get(:days),
        week_day: code_value.code_get(:week_day),
        week_days: code_value.code_get(:week_days),
        week: code_value.code_get(:week),
        weeks: code_value.code_get(:weeks)
      )
    end
  when "change"
    sig(args) do
      {
        year: (String | Integer).maybe,
        years: (String | Integer).maybe,
        month: (String | Integer).maybe,
        months: (String | Integer).maybe,
        day: (String | Integer).maybe,
        days: (String | Integer).maybe,
        week_day: (String | Integer).maybe,
        week_days: (String | Integer).maybe,
        week: (String | Integer).maybe,
        weeks: (String | Integer).maybe
      }
    end

    if code_value.nothing?
      code_change
    else
      code_change(
        year: code_value.code_get(:year),
        years: code_value.code_get(:years),
        month: code_value.code_get(:month),
        months: code_value.code_get(:months),
        day: code_value.code_get(:day),
        days: code_value.code_get(:days),
        week_day: code_value.code_get(:week_day),
        week_days: code_value.code_get(:week_days),
        week: code_value.code_get(:week),
        weeks: code_value.code_get(:weeks)
      )
    end
  else
    super
  end
end

#code_add(year: nil, years: nil, month: nil, months: nil, day: nil, days: nil, week_day: nil, week_days: nil, week: nil, weeks: nil) ⇒ Object



737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
# File 'lib/code/object/date.rb', line 737

def code_add(
  year: nil,
  years: nil,
  month: nil,
  months: nil,
  day: nil,
  days: nil,
  week_day: nil,
  week_days: nil,
  week: nil,
  weeks: nil
)
  code_year = year.to_code.nothing? ? years.to_code : year.to_code
  code_month = month.to_code.nothing? ? months.to_code : month.to_code
  code_day = day.to_code.nothing? ? days.to_code : day.to_code
  code_week_day =
    week_day.to_code.nothing? ? week_days.to_code : week_day.to_code
  code_week = week.to_code.nothing? ? weeks.to_code : week.to_code

  year = code_years.code_to_integer.raw + code_year.code_to_integer.raw
  month = code_months.code_to_integer.raw + code_month.code_to_integer.raw
  day = code_days.code_to_integer.raw + code_day.code_to_integer.raw
  week_day =
    code_week_days.code_to_integer.raw + code_week_day.code_to_integer.raw
  week = code_weeks.code_to_integer.raw + code_week.code_to_integer.raw

  code_change(year:, month:, day:, week_day:, week:)
end

#code_after?(other = nil) ⇒ Boolean

Returns:



549
550
551
552
553
554
# File 'lib/code/object/date.rb', line 549

def code_after?(other = nil)
  code_other = other.to_code
  code_other = Date.new if code_other.nothing?

  Boolean.new(raw.after?(code_other.raw))
end

#code_april?Boolean

Returns:



651
652
653
# File 'lib/code/object/date.rb', line 651

def code_april?
  code_month.code_four?
end

#code_august?Boolean

Returns:



667
668
669
# File 'lib/code/object/date.rb', line 667

def code_august?
  code_month.code_eight?
end

#code_before?(other = nil) ⇒ Boolean

Returns:



556
557
558
559
560
561
# File 'lib/code/object/date.rb', line 556

def code_before?(other = nil)
  code_other = other.to_code
  code_other = Date.new if code_other.nothing?

  Boolean.new(raw.before?(code_other.raw))
end

#code_change(year: nil, years: nil, month: nil, months: nil, day: nil, days: nil, week_day: nil, week_days: nil, week: nil, weeks: nil) ⇒ Object



795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
# File 'lib/code/object/date.rb', line 795

def code_change(
  year: nil,
  years: nil,
  month: nil,
  months: nil,
  day: nil,
  days: nil,
  week_day: nil,
  week_days: nil,
  week: nil,
  weeks: nil
)
  code_year = year.to_code.nothing? ? years.to_code : year.to_code
  code_month = month.to_code.nothing? ? months.to_code : month.to_code
  code_day = day.to_code.nothing? ? days.to_code : day.to_code
  code_week_day =
    week_day.to_code.nothing? ? week_days.to_code : week_day.to_code
  code_week = week.to_code.nothing? ? weeks.to_code : week.to_code

  year = code_year.raw || code_years.raw
  month = code_month.raw || code_months.raw
  day = code_day.raw || code_days.raw
  wday = code_week_day.raw || code_week_days.raw
  cweek = code_week.raw || code_weeks.raw

  dup = raw.dup
  dup += (year - raw.year).years
  dup += (month - raw.month).months
  dup += (day - raw.day).days
  dup += (wday - raw.wday).days
  dup += (cweek - raw.to_date.cweek).weeks

  Date.new(dup)
end

#code_currentObject



721
722
723
# File 'lib/code/object/date.rb', line 721

def code_current
  Date.new
end

#code_dayObject



603
604
605
# File 'lib/code/object/date.rb', line 603

def code_day
  Integer.new(raw.day)
end

#code_daysObject



607
608
609
# File 'lib/code/object/date.rb', line 607

def code_days
  Integer.new(raw.day)
end

#code_december?Boolean

Returns:



683
684
685
# File 'lib/code/object/date.rb', line 683

def code_december?
  code_month.code_twelve?
end

#code_february?Boolean

Returns:



643
644
645
# File 'lib/code/object/date.rb', line 643

def code_february?
  code_month.code_two?
end

#code_format(format) ⇒ Object



687
688
689
690
691
# File 'lib/code/object/date.rb', line 687

def code_format(format)
  code_format = format.to_code

  String.new(raw.strftime(code_format.raw))
end

#code_friday?Boolean

Returns:



627
628
629
# File 'lib/code/object/date.rb', line 627

def code_friday?
  code_week_day.code_five?
end

#code_future?Boolean

Returns:



567
568
569
# File 'lib/code/object/date.rb', line 567

def code_future?
  code_after?
end

#code_hourObject



693
694
695
# File 'lib/code/object/date.rb', line 693

def code_hour
  Integer.new(0)
end

#code_hoursObject



697
698
699
# File 'lib/code/object/date.rb', line 697

def code_hours
  Integer.new(0)
end

#code_january?Boolean

Returns:



639
640
641
# File 'lib/code/object/date.rb', line 639

def code_january?
  code_month.code_one?
end

#code_july?Boolean

Returns:



663
664
665
# File 'lib/code/object/date.rb', line 663

def code_july?
  code_month.code_seven?
end

#code_june?Boolean

Returns:



659
660
661
# File 'lib/code/object/date.rb', line 659

def code_june?
  code_month.code_six?
end

#code_march?Boolean

Returns:



647
648
649
# File 'lib/code/object/date.rb', line 647

def code_march?
  code_month.code_three?
end

#code_may?Boolean

Returns:



655
656
657
# File 'lib/code/object/date.rb', line 655

def code_may?
  code_month.code_five?
end

#code_minuteObject



701
702
703
# File 'lib/code/object/date.rb', line 701

def code_minute
  Integer.new(0)
end

#code_minutesObject



705
706
707
# File 'lib/code/object/date.rb', line 705

def code_minutes
  Integer.new(0)
end

#code_monday?Boolean

Returns:



611
612
613
# File 'lib/code/object/date.rb', line 611

def code_monday?
  code_week_day.code_one?
end

#code_monthObject



579
580
581
# File 'lib/code/object/date.rb', line 579

def code_month
  Integer.new(raw.month)
end

#code_monthsObject



583
584
585
# File 'lib/code/object/date.rb', line 583

def code_months
  Integer.new(raw.month)
end

#code_november?Boolean

Returns:



679
680
681
# File 'lib/code/object/date.rb', line 679

def code_november?
  code_month.code_eleven?
end

#code_nowObject



725
726
727
# File 'lib/code/object/date.rb', line 725

def code_now
  Date.new
end

#code_october?Boolean

Returns:



675
676
677
# File 'lib/code/object/date.rb', line 675

def code_october?
  code_month.code_ten?
end

#code_past?Boolean

Returns:



563
564
565
# File 'lib/code/object/date.rb', line 563

def code_past?
  code_before?
end

#code_saturday?Boolean

Returns:



631
632
633
# File 'lib/code/object/date.rb', line 631

def code_saturday?
  code_week_day.code_six?
end

#code_secondObject



709
710
711
# File 'lib/code/object/date.rb', line 709

def code_second
  Integer.new(0)
end

#code_secondsObject



713
714
715
# File 'lib/code/object/date.rb', line 713

def code_seconds
  Integer.new(0)
end

#code_september?Boolean

Returns:



671
672
673
# File 'lib/code/object/date.rb', line 671

def code_september?
  code_month.code_nine?
end

#code_substract(year: nil, years: nil, month: nil, months: nil, day: nil, days: nil, week_day: nil, week_days: nil, week: nil, weeks: nil) ⇒ Object



766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
# File 'lib/code/object/date.rb', line 766

def code_substract(
  year: nil,
  years: nil,
  month: nil,
  months: nil,
  day: nil,
  days: nil,
  week_day: nil,
  week_days: nil,
  week: nil,
  weeks: nil
)
  code_year = year.to_code.nothing? ? years.to_code : year.to_code
  code_month = month.to_code.nothing? ? months.to_code : month.to_code
  code_day = day.to_code.nothing? ? days.to_code : day.to_code
  code_week_day =
    week_day.to_code.nothing? ? week_days.to_code : week_day.to_code
  code_week = week.to_code.nothing? ? weeks.to_code : week.to_code

  year = code_years.code_to_integer.raw - code_year.code_to_integer.raw
  month = code_months.code_to_integer.raw - code_month.code_to_integer.raw
  day = code_days.code_to_integer.raw - code_day.code_to_integer.raw
  week_day =
    code_week_days.code_to_integer.raw - code_week_day.code_to_integer.raw
  week = code_weeks.code_to_integer.raw - code_week.code_to_integer.raw

  code_change(year:, month:, day:, week_day:, week:)
end

#code_sunday?Boolean

Returns:



635
636
637
# File 'lib/code/object/date.rb', line 635

def code_sunday?
  code_week_day.code_zero?
end

#code_thursday?Boolean

Returns:



623
624
625
# File 'lib/code/object/date.rb', line 623

def code_thursday?
  code_week_day.code_four?
end

#code_todayObject



717
718
719
# File 'lib/code/object/date.rb', line 717

def code_today
  Date.new
end

#code_tomorrowObject



729
730
731
# File 'lib/code/object/date.rb', line 729

def code_tomorrow
  code_add(day: 1)
end

#code_tuesday?Boolean

Returns:



615
616
617
# File 'lib/code/object/date.rb', line 615

def code_tuesday?
  code_week_day.code_two?
end

#code_wednesday?Boolean

Returns:



619
620
621
# File 'lib/code/object/date.rb', line 619

def code_wednesday?
  code_week_day.code_three?
end

#code_weekObject



587
588
589
# File 'lib/code/object/date.rb', line 587

def code_week
  Integer.new(raw.cweek)
end

#code_week_dayObject



595
596
597
# File 'lib/code/object/date.rb', line 595

def code_week_day
  Integer.new(raw.wday)
end

#code_week_daysObject



599
600
601
# File 'lib/code/object/date.rb', line 599

def code_week_days
  Integer.new(raw.wday)
end

#code_weeksObject



591
592
593
# File 'lib/code/object/date.rb', line 591

def code_weeks
  Integer.new(raw.cweek)
end

#code_yearObject



571
572
573
# File 'lib/code/object/date.rb', line 571

def code_year
  Integer.new(raw.year)
end

#code_yearsObject



575
576
577
# File 'lib/code/object/date.rb', line 575

def code_years
  Integer.new(raw.year)
end

#code_yesterdayObject



733
734
735
# File 'lib/code/object/date.rb', line 733

def code_yesterday
  code_substract(day: 1)
end