Class: BCDice::Arithmetic::Node::Negative

Inherits:
Object
  • Object
show all
Defined in:
lib/bcdice/arithmetic/node.rb

Instance Method Summary collapse

Constructor Details

#initialize(body) ⇒ Negative

Returns a new instance of Negative.



163
164
165
# File 'lib/bcdice/arithmetic/node.rb', line 163

def initialize(body)
  @body = body
end

Instance Method Details

#eval(round_type) ⇒ Object



167
168
169
# File 'lib/bcdice/arithmetic/node.rb', line 167

def eval(round_type)
  -@body.eval(round_type)
end

#outputString

Returns メッセージへの出力.

Returns:

  • (String)

    メッセージへの出力



172
173
174
# File 'lib/bcdice/arithmetic/node.rb', line 172

def output
  "-#{@body.output}"
end

#s_expObject



176
177
178
# File 'lib/bcdice/arithmetic/node.rb', line 176

def s_exp
  "(- #{@body.s_exp})"
end