Module: Fop::Compiler::Instructions

Defined in:
lib/fop/compiler.rb

Defined Under Namespace

Classes: ExpressionMatch, Op

Constant Summary collapse

BLANK =
"".freeze
OPERATIONS =
{
  "=" => Op.new(->(_val, args) { args[0] || BLANK }, 0, 1),
  "+" => Op.new(->(val, args) { val.to_i + args[0].to_i }, 1),
  "-" => Op.new(->(val, args) { val.to_i - args[0].to_i }, 1),
  ">" => Op.new(->(val, args) { val + args[0] }, 1),
  "<" => Op.new(->(val, args) { args[0] + val }, 1),
}

Class Method Summary collapse

Class Method Details

.regex_match(regex) ⇒ Object



37
38
39
# File 'lib/fop/compiler.rb', line 37

def self.regex_match(regex)
  ->(input) { input.slice! regex }
end