Sha256: 1114880604732988c78dde8690a1155b694a7652f71c15755afa329349949ee9

Contents?: true

Size: 509 Bytes

Versions: 24

Compression:

Stored size: 509 Bytes

Contents

require 'treetop'

module Merb
  module Global
    module Plural
      path = (Pathname.new(__FILE__).dirname.expand_path + 'plural')
      @parser = Treetop.load(path.to_s).new

      # Returns which form should be returned
      # ==== Parameters
      # n<Fixnum>:: A number of elements
      # plural<String>:: Expression
      # ==== Returns
      # Fixnum:: Which form should be translated
      def self.which_form(n, plural)
        @parser.parse(plural).to_lambda.call(n)
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 3 rubygems

Version Path
lastobelus-merb_global-0.0.10 lib/merb_global/plural.rb
lastobelus-merb_global-0.0.11 lib/merb_global/plural.rb
lastobelus-merb_global-0.0.12 lib/merb_global/plural.rb
lastobelus-merb_global-0.0.13 lib/merb_global/plural.rb
lastobelus-merb_global-0.0.14 lib/merb_global/plural.rb
lastobelus-merb_global-0.0.8 lib/merb_global/plural.rb
lastobelus-merb_global-0.0.9 lib/merb_global/plural.rb
emipair-merb_global-0.0.12 lib/merb_global/plural.rb
emipair-merb_global-0.0.11 lib/merb_global/plural.rb
emipair-merb_global-0.0.10 lib/merb_global/plural.rb
emipair-merb_global-0.0.9 lib/merb_global/plural.rb
emipair-merb_global-0.0.3 lib/merb_global/plural.rb
emipair-merb_global-0.0.2 lib/merb_global/plural.rb
emipair-merb_global-0.0.1 lib/merb_global/plural.rb
merb_global-0.0.3.1 lib/merb_global/plural.rb
merb_global-0.0.5.1 lib/merb_global/plural.rb
merb_global-0.0.7 lib/merb_global/plural.rb
merb_global-0.0.3 lib/merb_global/plural.rb
merb_global-0.0.5 lib/merb_global/plural.rb
merb_global-0.0.6 lib/merb_global/plural.rb