Class: BCDice::CommonCommand::AddDice::Node::Parenthesis

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

Overview

カッコで式をまとめるノード

Instance Method Summary collapse

Constructor Details

#initialize(expr) ⇒ Parenthesis

Returns a new instance of Parenthesis.

Parameters:

  • expr (Object)

    カッコ内のノード



586
587
588
# File 'lib/bcdice/common_command/add_dice/node.rb', line 586

def initialize(expr)
  @expr = expr
end

Instance Method Details

#eval(game_system, randomizer) ⇒ integer

Parameters:

Returns:

  • (integer)


592
593
594
# File 'lib/bcdice/common_command/add_dice/node.rb', line 592

def eval(game_system, randomizer)
  @expr.eval(game_system, randomizer)
end

#expr(game_system) ⇒ String

Returns:

  • (String)


602
603
604
# File 'lib/bcdice/common_command/add_dice/node.rb', line 602

def expr(game_system)
  "(#{@expr.expr(game_system)})"
end

#include_dice?Boolean

Returns:

  • (Boolean)


597
598
599
# File 'lib/bcdice/common_command/add_dice/node.rb', line 597

def include_dice?
  @expr.include_dice?
end

#outputString

Returns:

  • (String)


607
608
609
# File 'lib/bcdice/common_command/add_dice/node.rb', line 607

def output
  "(#{@expr.output})"
end

#s_expString

Returns S式.

Returns:

  • (String)

    S式



612
613
614
# File 'lib/bcdice/common_command/add_dice/node.rb', line 612

def s_exp
  "(Parenthesis #{@expr.s_exp})"
end