class Sf::StackOperation

Public Class Methods

new(operations: []) click to toggle source
# File lib/sf.rb, line 9
def initialize(operations: [])
  # puts "Initial Stack: #{operations}"
  @operations = operations
  @equality_called = false
end

Public Instance Methods

===(target)
Alias for: call
[](target)
Alias for: call
call(target) click to toggle source

Super naive for now, proof of concept. Will get order of ops later.

# File lib/sf.rb, line 20
def call(target)
  # puts "Streamed Target: #{target}"
  # puts "Evaluation Target: '#{target.inspect} #{@operations.join(' ')}'"

  eval("#{target.inspect} #{@operations.join(' ')}")
end
Also aliased as: ===, []
to_proc() click to toggle source
# File lib/sf.rb, line 15
def to_proc
  proc { |target| self.call(target) }
end