Sha256: f9d2563ea6ea40d23a21609a118d05baec08a2e4e264c396d49fb622d6ae085e

Contents?: true

Size: 599 Bytes

Versions: 18

Compression:

Stored size: 599 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[1], count: args.last}
      when :s_
        {msgid: args.first}
      else
        self.class.log("Unsupported FastGettext method #{@method}")
        {}
    end
    params
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
phrase-0.4.14 lib/phrase/delegate/fast_gettext.rb
phrase-0.4.13 lib/phrase/delegate/fast_gettext.rb
phrase-0.4.12 lib/phrase/delegate/fast_gettext.rb
phrase-0.4.11 lib/phrase/delegate/fast_gettext.rb
phrase-0.4.10 lib/phrase/delegate/fast_gettext.rb
phrase-0.4.9 lib/phrase/delegate/fast_gettext.rb
phrase-0.4.8 lib/phrase/delegate/fast_gettext.rb
phrase-0.4.7 lib/phrase/delegate/fast_gettext.rb
phrase-0.4.6 lib/phrase/delegate/fast_gettext.rb
phrase-0.4.5 lib/phrase/delegate/fast_gettext.rb
phrase-0.4.4 lib/phrase/delegate/fast_gettext.rb
phrase-0.4.3 lib/phrase/delegate/fast_gettext.rb
phrase-0.4.2 lib/phrase/delegate/fast_gettext.rb
phrase-0.4.1 lib/phrase/delegate/fast_gettext.rb
phrase-0.4.0 lib/phrase/delegate/fast_gettext.rb
phrase-0.3.7 lib/phrase/delegate/fast_gettext.rb
phrase-0.3.6 lib/phrase/delegate/fast_gettext.rb
phrase-0.3.5 lib/phrase/delegate/fast_gettext.rb