Module: ActionView::Helpers::DateHelper
- Includes:
- DOTIW::Methods
- Defined in:
- lib/dotiw/action_view/helpers/date_helper.rb
Instance Method Summary
collapse
#distance_of_time, #distance_of_time_in_words_hash, #time_ago_in_words
Instance Method Details
#_distance_of_time_in_words ⇒ Object
6
|
# File 'lib/dotiw/action_view/helpers/date_helper.rb', line 6
alias _distance_of_time_in_words distance_of_time_in_words
|
#distance_of_time_in_percent(from_time, current_time, to_time, options = {}) ⇒ Object
25
26
27
28
29
30
31
|
# File 'lib/dotiw/action_view/helpers/date_helper.rb', line 25
def distance_of_time_in_percent(from_time, current_time, to_time, options = {})
options[:precision] ||= 0
options = options_with_scope(options)
distance = to_time - from_time
result = ((current_time - from_time) / distance) * 100
number_with_precision(result, options).to_s + '%'
end
|
#distance_of_time_in_words(from_time, to_time = 0, include_seconds_or_options = {}, options = {}) ⇒ Object
11
12
13
14
15
16
|
# File 'lib/dotiw/action_view/helpers/date_helper.rb', line 11
def distance_of_time_in_words(from_time, to_time = 0, include_seconds_or_options = {}, options = {})
options = merge_options(include_seconds_or_options, options)
return _distance_of_time_in_words(from_time, to_time, options.except(:vague)) if options[:vague]
DOTIW::Methods.distance_of_time_in_words(from_time, to_time, options.except(:vague))
end
|
#distance_of_time_in_words_to_now(to_time = 0, include_seconds_or_options = {}, options = {}) ⇒ Object
18
19
20
21
22
23
|
# File 'lib/dotiw/action_view/helpers/date_helper.rb', line 18
def distance_of_time_in_words_to_now(to_time = 0, include_seconds_or_options = {}, options = {})
options = merge_options(include_seconds_or_options, options)
return _distance_of_time_in_words(Time.now, to_time, options.except(:vague)) if options[:vague]
DOTIW::Methods.distance_of_time_in_words(Time.now, to_time, options.except(:vague))
end
|