class So::Index

Public Class Methods

index(x, index) click to toggle source
# File lib/spec_object.rb, line 185
def self.index(x, index)
  x = x.to_so_expr
  index = index.to_so_expr

  if x.kind_of?(Const) && index.kind_of?(Const)
    (x.value[index.value]).to_so_expr
  else
    new(x, index)
  end
end
new(x, index) click to toggle source
# File lib/spec_object.rb, line 180
def initialize(x, index)
  @x = x
  @index = index
end

Public Instance Methods

pp(n) click to toggle source
# File lib/spec_object.rb, line 196
def pp(n)
  "#{@x.pp(n)}[#{@index.pp(0)}]"
end
substitute(v, e) click to toggle source
# File lib/spec_object.rb, line 200
def substitute(v, e)
  Index.index(@x.substitute(v, e), @index.substitute(v, e))
end