module Patm::Pattern::Util

Public Class Methods

compile_value(value, free_index) click to toggle source
# File lib/patm.rb, line 47
def self.compile_value(value, free_index)
  if value.nil? || value.is_a?(Numeric) || value.is_a?(String) || value.is_a?(Symbol)
    [
      value.inspect,
      [],
      free_index,
    ]
  else
    [
      "_ctx[#{free_index}]",
      [value],
      free_index + 1,
    ]
  end
end