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
- #prefix_number ⇒ Integer?
- #question_target ⇒ Boolean writeonly
- #suffix_number ⇒ Integer?
- #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.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/bcdice/command/parsed.rb', line 37 def initialize @prefix_number = nil @suffix_number = nil @critical = nil @fumble = nil @dollar = nil @cmp_op = nil @target_number = nil @question_target = false end |
Instance Attribute Details
#cmp_op ⇒ Symbol?
28 29 30 |
# File 'lib/bcdice/command/parsed.rb', line 28 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?
16 17 18 |
# File 'lib/bcdice/command/parsed.rb', line 16 def critical @critical end |
#dollar ⇒ Integer?
22 23 24 |
# File 'lib/bcdice/command/parsed.rb', line 22 def dollar @dollar end |
#fumble ⇒ Integer?
19 20 21 |
# File 'lib/bcdice/command/parsed.rb', line 19 def fumble @fumble end |
#modify_number ⇒ Integer
25 26 27 |
# File 'lib/bcdice/command/parsed.rb', line 25 def modify_number @modify_number end |
#prefix_number ⇒ Integer?
10 11 12 |
# File 'lib/bcdice/command/parsed.rb', line 10 def prefix_number @prefix_number end |
#question_target=(value) ⇒ Boolean (writeonly)
35 36 37 |
# File 'lib/bcdice/command/parsed.rb', line 35 def question_target=(value) @question_target = value end |
#suffix_number ⇒ Integer?
13 14 15 |
# File 'lib/bcdice/command/parsed.rb', line 13 def suffix_number @suffix_number end |
#target_number ⇒ Integer?
31 32 33 |
# File 'lib/bcdice/command/parsed.rb', line 31 def target_number @target_number end |
Instance Method Details
#question_target? ⇒ Boolean
49 50 51 |
# File 'lib/bcdice/command/parsed.rb', line 49 def question_target? @question_target end |
#to_s(suffix_position = :after_command) ⇒ String
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/bcdice/command/parsed.rb', line 55 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 [@prefix_number, @command, @suffix_number, c, f, d, m, @cmp_op, target].join() when :after_modify_number [@prefix_number, @command, @suffix_number, m, c, f, d, @cmp_op, target].join() when :after_target_number [@prefix_number, @command, @suffix_number, m, @cmp_op, target, c, f, d].join() end end |