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.
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
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
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
597 598 599 |
# File 'lib/bcdice/common_command/add_dice/node.rb', line 597 def include_dice? @expr.include_dice? end |
#output ⇒ String
607 608 609 |
# File 'lib/bcdice/common_command/add_dice/node.rb', line 607 def output "(#{@expr.output})" end |
#s_exp ⇒ String
Returns S式.
612 613 614 |
# File 'lib/bcdice/common_command/add_dice/node.rb', line 612 def s_exp "(Parenthesis #{@expr.s_exp})" end |