Sha256: adf57a6ac2ec9add1b99da0b3a039b7d74857a35d85741ef2014e65cccb65dac

Contents?: true

Size: 602 Bytes

Versions: 3

Compression:

Stored size: 602 Bytes

Contents

# -*- encoding : utf-8 -*-

require 'phrase/delegate'

class Phrase::Delegate::FastGettext < Phrase::Delegate::Base
  def initialize(method, *args)
    @method = method
    params = params_from_args(args)
    @display_key = params[:msgid]
  end
  
private
  def params_from_args(args)
    params = case @method
      when :_
        {msgid: args.first}
      when :n_
        {msgid: args.first, msgid_plural: args.second, count: args.last}
      when :s_
        {msgid: args.first}
      else
        self.class.log("Unsupported FastGettext method #{@method}")
        {}
    end
    params
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
phrase-0.3.4 lib/phrase/delegate/fast_gettext.rb
phrase-0.3.3 lib/phrase/delegate/fast_gettext.rb
phrase-0.3.2 lib/phrase/delegate/fast_gettext.rb