Created
April 14, 2019 03:26
-
-
Save leiminghany/52e75d0425c47187d0649f5091b6a428 to your computer and use it in GitHub Desktop.
gitlab ruby syntax
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From: /opt/gitlab/gitlab/gdk-ce/gitlab/lib/gitlab/i18n.rb @ line 61 Gitlab::I18n#with_user_locale: | |
60: def with_user_locale(user, &block) | |
=> 61: with_locale(user&.preferred_language, &block) | |
62: end | |
[57] pry(Gitlab::I18n)> user | |
=> nil | |
[58] pry(Gitlab::I18n)> show-source block | |
From: /opt/gitlab/gitlab/.rvm/gems/ruby-2.5.3/gems/activesupport-5.0.7.1/lib/active_support/callbacks.rb | |
Number of lines: 3 | |
user_callback.call(target, value) { | |
run.call.value | |
} | |
[59] pry(Gitlab::I18n)> down | |
From: /opt/gitlab/gitlab/gdk-ce/gitlab/lib/gitlab/i18n.rb @ line 54 Gitlab::I18n#with_locale: | |
51: def with_locale(locale_string) | |
52: original_locale = locale | |
53: | |
=> 54: self.locale = locale_string | |
55: yield | |
56: ensure | |
57: self.locale = original_locale | |
58: end | |
[59] pry(Gitlab::I18n)> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment