aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-02-05 16:26:00 -0200
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-02-05 16:26:16 -0200
commit003c0cda26e3fa9c3362ac7e5b5faa6236b44aad (patch)
tree57f9524ef8cd6b4e3f50ec5816676dc675dbe1f0 /actionview/lib
parentd80996ea8d58ffee87224ae9df9124f2e5462160 (diff)
downloadrails-003c0cda26e3fa9c3362ac7e5b5faa6236b44aad.tar.gz
rails-003c0cda26e3fa9c3362ac7e5b5faa6236b44aad.tar.bz2
rails-003c0cda26e3fa9c3362ac7e5b5faa6236b44aad.zip
Use kwags to make the argument meaning explicit
Diffstat (limited to 'actionview/lib')
-rw-r--r--actionview/lib/action_view/helpers/tags/label.rb2
-rw-r--r--actionview/lib/action_view/helpers/tags/placeholderable.rb2
-rw-r--r--actionview/lib/action_view/helpers/tags/translator.rb8
3 files changed, 6 insertions, 6 deletions
diff --git a/actionview/lib/action_view/helpers/tags/label.rb b/actionview/lib/action_view/helpers/tags/label.rb
index 25f7cafcb8..4159cb105f 100644
--- a/actionview/lib/action_view/helpers/tags/label.rb
+++ b/actionview/lib/action_view/helpers/tags/label.rb
@@ -17,7 +17,7 @@ module ActionView
method_and_value = @tag_value.present? ? "#{@method_name}.#{@tag_value}" : @method_name
content ||= Translator
- .new(object, @object_name, method_and_value, "helpers.label")
+ .new(object, @object_name, method_and_value, scope: "helpers.label")
.call
content ||= @method_name.humanize
diff --git a/actionview/lib/action_view/helpers/tags/placeholderable.rb b/actionview/lib/action_view/helpers/tags/placeholderable.rb
index 0b15a11308..db16ea7b0b 100644
--- a/actionview/lib/action_view/helpers/tags/placeholderable.rb
+++ b/actionview/lib/action_view/helpers/tags/placeholderable.rb
@@ -10,7 +10,7 @@ module ActionView
method_and_value = tag_value.is_a?(TrueClass) ? @method_name : "#{@method_name}.#{tag_value}"
placeholder ||= Tags::Translator
- .new(object, @object_name, method_and_value, "helpers.placeholder")
+ .new(object, @object_name, method_and_value, scope: "helpers.placeholder")
.call
placeholder ||= @method_name.humanize
@options[:placeholder] = placeholder
diff --git a/actionview/lib/action_view/helpers/tags/translator.rb b/actionview/lib/action_view/helpers/tags/translator.rb
index a65bd35f4d..86d7d21308 100644
--- a/actionview/lib/action_view/helpers/tags/translator.rb
+++ b/actionview/lib/action_view/helpers/tags/translator.rb
@@ -2,21 +2,21 @@ module ActionView
module Helpers
module Tags # :nodoc:
class Translator # :nodoc:
- def initialize(object, object_name, method_and_value, i18n_scope)
+ def initialize(object, object_name, method_and_value, scope:)
@object_name = object_name.gsub(/\[(.*)_attributes\]\[\d+\]/, '.\1')
@method_and_value = method_and_value
- @i18n_scope = i18n_scope
+ @scope = scope
@model = object.respond_to?(:to_model) ? object.to_model : object
end
def call
- translated_attribute = I18n.t("#{object_name}.#{method_and_value}", default: i18n_default, scope: i18n_scope).presence
+ translated_attribute = I18n.t("#{object_name}.#{method_and_value}", default: i18n_default, scope: scope).presence
translated_attribute || human_attribute_name
end
private
- attr_reader :object_name, :method_and_value, :i18n_scope, :model
+ attr_reader :object_name, :method_and_value, :scope, :model
def i18n_default
if model