class PosxmlCompiler::Function

Attributes

functions[R]
number[R]

Public Class Methods

new() click to toggle source
# File lib/posxml_compiler/function.rb, line 5
def initialize
  @functions = {}
  @number = 0
end

Public Instance Methods

get(name) click to toggle source
# File lib/posxml_compiler/function.rb, line 10
def get(name)
  return if name.to_s.empty?
  name[0] = name[0].downcase
  if @functions[name]
    @functions[name]
  else
    @functions[name] = next_number
  end
end
next_number() click to toggle source
# File lib/posxml_compiler/function.rb, line 20
def next_number
  (@number += 1).to_s
end