class TwitterCldr::Transforms::VariableRule

Attributes

name[R]
value_tokens[R]

Public Class Methods

accepts?(rule_text) click to toggle source
# File lib/twitter_cldr/transforms/variable_rule.rb, line 49
def accepts?(rule_text)
  !!(rule_text =~ /\A[\s]*\$[\w]+[\s]*=/)
end
new(name, value) click to toggle source
# File lib/twitter_cldr/transforms/variable_rule.rb, line 66
def initialize(name, value)
  @name = name
  @value_tokens = value
end
parse(rule_text, symbol_table, index) click to toggle source
# File lib/twitter_cldr/transforms/variable_rule.rb, line 37
def parse(rule_text, symbol_table, index)
  cleaned_rule_text = Rule.remove_comment(rule_text)
  tokens = tokenizer.tokenize(cleaned_rule_text)
  var_name, value_tokens = parser.parse(tokens)

  VariableRule.new(
    var_name, replace_symbols(
      value_tokens, symbol_table
    )
  )
end

Private Class Methods

parser() click to toggle source
# File lib/twitter_cldr/transforms/variable_rule.rb, line 55
def parser
  @parser ||= Parser.new
end
tokenizer() click to toggle source
# File lib/twitter_cldr/transforms/variable_rule.rb, line 59
def tokenizer
  @tokenizer ||= TwitterCldr::Transforms::Tokenizer.new
end

Public Instance Methods

is_variable?() click to toggle source
# File lib/twitter_cldr/transforms/variable_rule.rb, line 71
def is_variable?
  true
end