class Tml::Tokens::XMessage::Choice

Choice Token

{0} tagged himself/herself in {1,choice,singular#{1,number} {2,map,photo#photo|video#video}|plural#{1,number} {2,map,photo#photos|video#videos}}.

Attributes

rule_keys[RW]

Public Class Methods

new(label, opts) click to toggle source
# File lib/tml/tokens/x_message/choice.rb, line 45
def initialize(label, opts)
  @label = label
  @short_name = opts[:index]
  @full_name = "{#{@short_name}}"
  @rule_keys = opts[:styles].collect{|style| style[:key]}
  @case_keys = []
  @context_keys = []
  if @rule_keys.include?('singular') or @rule_keys.include?('plural')
    @context_keys = ['number']
  elsif @rule_keys.include?('male') or @rule_keys.include?('female')
    @context_keys = ['gender']
  elsif @rule_keys.include?('past') or @rule_keys.include?('present') or @rule_keys.include?('future')
    @context_keys = ['date']
  end
end