Class: BCDice::Result
- Inherits:
-
Object
show all
- Defined in:
- lib/bcdice/result.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(text = nil) ⇒ Result
Returns a new instance of Result.
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/bcdice/result.rb', line 41
def initialize(text = nil)
@text = text
@rands = nil
@detailed_rands = nil
@secret = false
@success = false
@failure = false
@critical = false
@fumble = false
end
|
Instance Attribute Details
#critical=(value) ⇒ Object
Sets the attribute critical
53
54
55
|
# File 'lib/bcdice/result.rb', line 53
def critical=(value)
@critical = value
end
|
#detailed_rands ⇒ Object
Returns the value of attribute detailed_rands.
52
53
54
|
# File 'lib/bcdice/result.rb', line 52
def detailed_rands
@detailed_rands
end
|
#failure=(value) ⇒ Object
Sets the attribute failure
53
54
55
|
# File 'lib/bcdice/result.rb', line 53
def failure=(value)
@failure = value
end
|
#fumble=(value) ⇒ Object
Sets the attribute fumble
53
54
55
|
# File 'lib/bcdice/result.rb', line 53
def fumble=(value)
@fumble = value
end
|
#rands ⇒ Object
Returns the value of attribute rands.
52
53
54
|
# File 'lib/bcdice/result.rb', line 52
def rands
@rands
end
|
#secret=(value) ⇒ Object
Sets the attribute secret
53
54
55
|
# File 'lib/bcdice/result.rb', line 53
def secret=(value)
@secret = value
end
|
#success=(value) ⇒ Object
Sets the attribute success
53
54
55
|
# File 'lib/bcdice/result.rb', line 53
def success=(value)
@success = value
end
|
#text ⇒ Object
Returns the value of attribute text.
52
53
54
|
# File 'lib/bcdice/result.rb', line 52
def text
@text
end
|
Class Method Details
.critical(text) ⇒ Object
20
21
22
23
24
25
26
|
# File 'lib/bcdice/result.rb', line 20
def critical(text)
new.tap do |r|
r.text = text
r.critical = true
r.success = true
end
end
|
.failure(text) ⇒ Object
13
14
15
16
17
18
|
# File 'lib/bcdice/result.rb', line 13
def failure(text)
new.tap do |r|
r.text = text
r.failure = true
end
end
|
.fumble(text) ⇒ Object
28
29
30
31
32
33
34
|
# File 'lib/bcdice/result.rb', line 28
def fumble(text)
new.tap do |r|
r.text = text
r.fumble = true
r.failure = true
end
end
|
.nothing ⇒ Object
36
37
38
|
# File 'lib/bcdice/result.rb', line 36
def nothing
:nothing
end
|
.success(text) ⇒ Object
6
7
8
9
10
11
|
# File 'lib/bcdice/result.rb', line 6
def success(text)
new.tap do |r|
r.text = text
r.success = true
end
end
|
Instance Method Details
#condition=(condition) ⇒ void
This method returns an undefined value.
82
83
84
85
|
# File 'lib/bcdice/result.rb', line 82
def condition=(condition)
@success = condition
@failure = !condition
end
|
#critical? ⇒ Boolean
71
72
73
|
# File 'lib/bcdice/result.rb', line 71
def critical?
@critical
end
|
#failure? ⇒ Boolean
66
67
68
|
# File 'lib/bcdice/result.rb', line 66
def failure?
@failure
end
|
#fumble? ⇒ Boolean
76
77
78
|
# File 'lib/bcdice/result.rb', line 76
def fumble?
@fumble
end
|
#secret? ⇒ Boolean
56
57
58
|
# File 'lib/bcdice/result.rb', line 56
def secret?
@secret
end
|
#success? ⇒ Boolean
61
62
63
|
# File 'lib/bcdice/result.rb', line 61
def success?
@success
end
|