Class: Pod::Command::MPAAS::SetLang
- Inherits:
-
Pod::Command::MPAAS
- Object
- Pod::Command
- Pod::Command::MPAAS
- Pod::Command::MPAAS::SetLang
- Defined in:
- lib/cocoapods-mPaaS/command/mpaas/local_command.rb
Overview
— 设置语言子命令 —
Instance Method Summary collapse
-
#initialize(argv) ⇒ SetLang
constructor
A new instance of SetLang.
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(argv) ⇒ SetLang
Returns a new instance of SetLang.
31 32 33 34 |
# File 'lib/cocoapods-mPaaS/command/mpaas/local_command.rb', line 31 def initialize(argv) @language_code = argv.shift_argument # 获取第一个非选项参数作为语言代码 super # 调用父类的 initialize end |
Instance Method Details
#run ⇒ Object
41 42 43 44 45 |
# File 'lib/cocoapods-mPaaS/command/mpaas/local_command.rb', line 41 def run Pod::MPAAS::Localization.set_language(@language_code) Pod::UI.puts Pod::MPAAS::Localization.t('mpaas.commands.set_lang.success_message', lang_code: @language_code) Pod::UI.puts Pod::MPAAS::Localization.t('mpaas.commands.set_lang.restart_note') end |
#validate! ⇒ Object
36 37 38 39 |
# File 'lib/cocoapods-mPaaS/command/mpaas/local_command.rb', line 36 def validate! super help! Pod::MPAAS::Localization.t('mpaas.commands.set_lang.language_code_required') unless @language_code end |