class PhraseApp::InContextEditor::Delegate::FastGettext

Public Class Methods

new(method, *args) click to toggle source
# File lib/phraseapp-in-context-editor-ruby/delegate/fast_gettext.rb, line 8
def initialize(method, *args)
  @method = method
  params = params_from_args(args)
  @display_key = params[:msgid]
end

Private Instance Methods

params_from_args(args) click to toggle source
# File lib/phraseapp-in-context-editor-ruby/delegate/fast_gettext.rb, line 15
def params_from_args(args)
  params = case @method
    when :_
      {msgid: args.first}
    when :n_
      {msgid: args.first, msgid_plural: args[1], count: args.last}
    when :s_
      {msgid: args.first}
    else
      self.class.log("Unsupported FastGettext method #{@method}")
      {}
  end
  params
end