Class: BinOpe

Inherits:
Latex show all
Defined in:
lib/annlat/LaRuby.rb

Direct Known Subclasses

AssocBinOpe

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Latex

#*, #**, #+, #-, #-@, #/, #glue, #is, #my_json, #ne, #of, #to_ltx, #wrap

Constructor Details

#initialize(some_oper, *some_args) ⇒ BinOpe

Returns a new instance of BinOpe.



122
123
124
125
126
127
128
# File 'lib/annlat/LaRuby.rb', line 122

def initialize(some_oper, *some_args)
  @oper = some_oper.to_ltx
  some_args.map!(&:to_ltx)
  first = some_args[0]
  rest = some_args[1..-1].map {|a| (a.kind_of?(BinOpe) and a.args[0].kind_of?(Negative)) ? a.wrap : a }
  @args = [first] + rest
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



119
120
121
# File 'lib/annlat/LaRuby.rb', line 119

def args
  @args
end

#operObject (readonly)

Returns the value of attribute oper.



120
121
122
# File 'lib/annlat/LaRuby.rb', line 120

def oper
  @oper
end

Instance Method Details

#latexObject



130
131
132
# File 'lib/annlat/LaRuby.rb', line 130

def latex
  @args.map{|a| a.latex}.join(@oper.latex)
end