Class: BCDice::Command::Parsed
- Inherits:
-
Object
- Object
- BCDice::Command::Parsed
- Defined in:
- lib/bcdice/command/parsed.rb
Instance Attribute Summary collapse
- #cmp_op ⇒ Symbol?
- #command ⇒ String
- #critical ⇒ Integer?
- #dollar ⇒ Integer?
- #fumble ⇒ Integer?
- #modify_number ⇒ Integer
- #question_target ⇒ Boolean writeonly
- #target_number ⇒ Integer?
Instance Method Summary collapse
-
#initialize ⇒ Parsed
constructor
A new instance of Parsed.
- #question_target? ⇒ Boolean
- #to_s(suffix_position = :after_command) ⇒ String
Constructor Details
#initialize ⇒ Parsed
Returns a new instance of Parsed.
31 32 33 34 35 36 37 38 |
# File 'lib/bcdice/command/parsed.rb', line 31 def initialize @critical = nil @fumble = nil @dollar = nil @cmp_op = nil @target_number = nil @question_target = false end |
Instance Attribute Details
#cmp_op ⇒ Symbol?
22 23 24 |
# File 'lib/bcdice/command/parsed.rb', line 22 def cmp_op @cmp_op end |
#command ⇒ String
7 8 9 |
# File 'lib/bcdice/command/parsed.rb', line 7 def command @command end |
#critical ⇒ Integer?
10 11 12 |
# File 'lib/bcdice/command/parsed.rb', line 10 def critical @critical end |
#dollar ⇒ Integer?
16 17 18 |
# File 'lib/bcdice/command/parsed.rb', line 16 def dollar @dollar end |
#fumble ⇒ Integer?
13 14 15 |
# File 'lib/bcdice/command/parsed.rb', line 13 def fumble @fumble end |
#modify_number ⇒ Integer
19 20 21 |
# File 'lib/bcdice/command/parsed.rb', line 19 def modify_number @modify_number end |
#question_target=(value) ⇒ Boolean (writeonly)
29 30 31 |
# File 'lib/bcdice/command/parsed.rb', line 29 def question_target=(value) @question_target = value end |
#target_number ⇒ Integer?
25 26 27 |
# File 'lib/bcdice/command/parsed.rb', line 25 def target_number @target_number end |
Instance Method Details
#question_target? ⇒ Boolean
41 42 43 |
# File 'lib/bcdice/command/parsed.rb', line 41 def question_target? @question_target end |
#to_s(suffix_position = :after_command) ⇒ String
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/bcdice/command/parsed.rb', line 47 def to_s(suffix_position = :after_command) c = @critical ? "@#{@critical}" : nil f = @fumble ? "##{@fumble}" : nil d = @dollar ? "$#{@dollar}" : nil m = Format.modifier(@modify_number) target = @question_target ? "?" : @target_number case suffix_position when :after_command [@command, c, f, d, m, @cmp_op, target].join() when :after_modify_number [@command, m, c, f, d, @cmp_op, target].join() when :after_target_number [@command, m, @cmp_op, target, c, f, d].join() end end |