dieroll 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  module Dieroll
2
2
  class DiceSet
3
+ attr_reader :last_results
3
4
 
4
5
  #Create DiceSet object
5
6
  def initialize(number_of_dice, sides, sign='+', drop_string=nil)
@@ -76,17 +76,29 @@ module::Dieroll
76
76
  end
77
77
 
78
78
  # Return roll result as string
79
- def report
80
- output = @total.to_s + "\n"
81
- output += @string.to_s + ":\n"
82
- @dice_sets.each do |set|
83
- output += set.report + "\n"
84
- end
85
- @mods.each do |mod|
86
- output += "+" if mod >= 0
87
- output += mod.to_s + "\n"
79
+ def report(formatted=true)
80
+ if(formatted)
81
+ output = @total.to_s + "\n"
82
+ output += @string.to_s + ":\n"
83
+ @dice_sets.each do |set|
84
+ output += set.report + "\n"
85
+ end
86
+ @mods.each do |mod|
87
+ output += "+" if mod >= 0
88
+ output += mod.to_s + "\n"
89
+ end
90
+ else
91
+ set_reports = []
92
+ @dice_sets.each do |set|
93
+ set_reports << set.report
94
+ end
95
+ output = {
96
+ :total => @total,
97
+ :string => @string,
98
+ :sets => set_reports,
99
+ :mods => @mods}
88
100
  end
89
-
101
+
90
102
  output
91
103
  end
92
104
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dieroll
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: