Commit 4ce376c0 authored by Tomasz Maczukin's avatar Tomasz Maczukin

Rename chronic_duration_attribute* to chronic_duration_attr*

parent c21e817a
......@@ -91,7 +91,7 @@ module Ci
after_commit :update_project_statistics_after_save, on: [:create, :update]
after_commit :update_project_statistics, on: :destroy
chronic_duration_attribute_reader :used_timeout_user_readable, :used_timeout
chronic_duration_attr_reader :used_timeout_user_readable, :used_timeout
class << self
# This is needed for url_for to work,
......
......@@ -52,7 +52,7 @@ module Ci
cached_attr_reader :version, :revision, :platform, :architecture, :contacted_at, :ip_address
chronic_duration_attribute :maximum_job_timeout_user_readable, :maximum_job_timeout
chronic_duration_attr :maximum_job_timeout_user_readable, :maximum_job_timeout
# Searches for runners matching the given query.
#
......
......@@ -2,19 +2,19 @@ module ChronicDurationAttribute
extend ActiveSupport::Concern
class_methods do
def chronic_duration_attribute(virtual_attribute, source_attribute)
chronic_duration_attribute_reader(virtual_attribute, source_attribute)
chronic_duration_attribute_writer(virtual_attribute, source_attribute)
def chronic_duration_attr(virtual_attribute, source_attribute)
chronic_duration_attr_reader(virtual_attribute, source_attribute)
chronic_duration_attr_writer(virtual_attribute, source_attribute)
end
def chronic_duration_attribute_reader(virtual_attribute, source_attribute)
def chronic_duration_attr_reader(virtual_attribute, source_attribute)
define_method(virtual_attribute) do
value = self.send(source_attribute) # rubocop:disable GitlabSecurity/PublicSend
ChronicDuration.output(value, format: :short) unless value.nil?
end
end
def chronic_duration_attribute_writer(virtual_attribute, source_attribute)
def chronic_duration_attr_writer(virtual_attribute, source_attribute)
define_method("#{virtual_attribute}=") do |value|
new_value = ChronicDuration.parse(value).to_i
self.send("#{source_attribute}=", new_value) # rubocop:disable GitlabSecurity/PublicSend
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment