Class: Time
Constant Summary
collapse
- MAX_PRECISION =
DateTimePrecision::SEC
DateTimePrecision::DATE_ATTRIBUTES, DateTimePrecision::DATE_ATTRIBUTE_PRECISIONS, DateTimePrecision::DAY, DateTimePrecision::FRAC, DateTimePrecision::HOUR, DateTimePrecision::ISO8601_DATE_FRAGMENTS, DateTimePrecision::ISO8601_TIME_FRAGMENTS, DateTimePrecision::MIN, DateTimePrecision::MONTH, DateTimePrecision::NEW_DEFAULTS, DateTimePrecision::NONE, DateTimePrecision::PATCH_VERSION, DateTimePrecision::SEC, DateTimePrecision::VERSION, DateTimePrecision::YEAR
Class Method Summary
collapse
Instance Method Summary
collapse
#as_json, #fragments, included, #partial_match?, precision, #precision, #precision=, #to_h, #to_json
Class Method Details
.gm ⇒ Object
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/date_time_precision/patch/1.8.7/time.rb', line 46
def utc(*args)
orig_args = args.shift(Time::MAX_PRECISION)
precision = self.precision(orig_args)
time_args = normalize_new_args(orig_args)
t = utc_without_prec(*[time_args, args].flatten)
t.precision = precision
t.attributes_set(orig_args)
t
end
|
.local(*args) ⇒ Object
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/date_time_precision/patch/1.8.7/time.rb', line 49
def local(*args)
orig_args = args.shift(Time::MAX_PRECISION)
precision = self.precision(orig_args)
time_args = normalize_new_args(orig_args)
t = local_without_prec(*[time_args, args].flatten)
t.precision = precision
t.attributes_set(orig_args)
t
end
|
.local_without_prec ⇒ Object
48
|
# File 'lib/date_time_precision/patch/1.8.7/time.rb', line 48
alias_method :local_without_prec, :local
|
.make_time(*args) ⇒ Object
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/date_time_precision/patch/1.8.7/time.rb', line 23
def make_time(*args)
orig_args = args.shift(Time::MAX_PRECISION)
precision = self.precision(orig_args)
time_args = normalize_new_args(orig_args)
t = make_time_orig(*[time_args, args].flatten)
t.precision = precision
t.attributes_set(orig_args)
t
end
|
.make_time_orig ⇒ Object
22
|
# File 'lib/date_time_precision/patch/1.8.7/time.rb', line 22
alias_method :make_time_orig, :make_time
|
.mktime(*args) ⇒ Object
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/date_time_precision/patch/1.8.7/time.rb', line 11
def mktime(*args)
orig_args = args.shift(Time::MAX_PRECISION)
precision = self.precision(orig_args)
time_args = normalize_new_args(orig_args)
t = mktime_orig(*[time_args, args].flatten)
t.precision = precision
t.attributes_set(orig_args)
t
end
|
.mktime_orig ⇒ Object
10
|
# File 'lib/date_time_precision/patch/1.8.7/time.rb', line 10
alias_method :mktime_orig, :mktime
|
.utc(*args) ⇒ Object
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/date_time_precision/patch/1.8.7/time.rb', line 36
def utc(*args)
orig_args = args.shift(Time::MAX_PRECISION)
precision = self.precision(orig_args)
time_args = normalize_new_args(orig_args)
t = utc_without_prec(*[time_args, args].flatten)
t.precision = precision
t.attributes_set(orig_args)
t
end
|
.utc_without_prec ⇒ Object
35
|
# File 'lib/date_time_precision/patch/1.8.7/time.rb', line 35
alias_method :utc_without_prec, :utc
|
Instance Method Details
#utc(*args) ⇒ Object
62
63
64
65
66
|
# File 'lib/date_time_precision/patch/1.8.7/time.rb', line 62
def utc(*args)
t = utc_without_prec(*args)
t.precision = self.precision
t
end
|
#utc_without_prec ⇒ Object
61
|
# File 'lib/date_time_precision/patch/1.8.7/time.rb', line 61
alias_method :utc_without_prec, :utc
|