Class: BCDice::CommonCommand::AddDice::Node::Parenthesis
- Inherits:
-
Object
- Object
- BCDice::CommonCommand::AddDice::Node::Parenthesis
- Defined in:
- lib/bcdice/common_command/add_dice/node.rb
Overview
カッコで式をまとめるノード
Instance Method Summary collapse
- #eval(game_system, randomizer) ⇒ integer
- #expr(game_system) ⇒ String
- #include_dice? ⇒ Boolean
-
#initialize(expr) ⇒ Parenthesis
constructor
A new instance of Parenthesis.
- #output ⇒ String
-
#s_exp ⇒ String
S式.
Constructor Details
#initialize(expr) ⇒ Parenthesis
Returns a new instance of Parenthesis.
562 563 564 |
# File 'lib/bcdice/common_command/add_dice/node.rb', line 562 def initialize(expr) @expr = expr end |
Instance Method Details
#eval(game_system, randomizer) ⇒ integer
568 569 570 |
# File 'lib/bcdice/common_command/add_dice/node.rb', line 568 def eval(game_system, randomizer) @expr.eval(game_system, randomizer) end |
#expr(game_system) ⇒ String
578 579 580 |
# File 'lib/bcdice/common_command/add_dice/node.rb', line 578 def expr(game_system) "(#{@expr.expr(game_system)})" end |
#include_dice? ⇒ Boolean
573 574 575 |
# File 'lib/bcdice/common_command/add_dice/node.rb', line 573 def include_dice? @expr.include_dice? end |
#output ⇒ String
583 584 585 |
# File 'lib/bcdice/common_command/add_dice/node.rb', line 583 def output "(#{@expr.output})" end |
#s_exp ⇒ String
Returns S式.
588 589 590 |
# File 'lib/bcdice/common_command/add_dice/node.rb', line 588 def s_exp "(Parenthesis #{@expr.s_exp})" end |