gloomhaven 1.0.5 → 1.0.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0a68a6302a5ef217ff720a198849c57281d97d8f3ab82b408dd84ccd91401c24
4
- data.tar.gz: fbde2a84dee1c47de00b31638a6ac8df9ad7f41a428b99e95b90443ac58d0fa4
3
+ metadata.gz: 2add0e7f10741e013730ec49e2fa74b41c0697a1e83c86efc26461890c61ba9d
4
+ data.tar.gz: 9a9a707767100ddcb3f0646edadb101fccb994419fe9f0652049f901251f96f2
5
5
  SHA512:
6
- metadata.gz: 51acac5cada8f4c9d7ccc16da03cff1214487b6d59e23dadfd46309f18ddd03d128f7d9599d99c5829ff71a359149096c645e3041cbed418ebb698b95bb643a8
7
- data.tar.gz: 5e5baa61ed10f61ebc569cb1805975a4f3dd08f5f7ae3ac06a2f9efca277b1a52c6cac5f626c6829c6c12ef992d8a283455d1c89ec0960dacb1b2375a06b1f61
6
+ metadata.gz: 29cb890057f73eb0edce73463054b8596314382094cfd84bb075a65ee4b13afa3da7b7ace5c2c9147ae819ae9917dd61abec6567fc97e9adfc8427f391cedf85
7
+ data.tar.gz: bff3c169b51ecb80f7e25cad49df6cbcc2e55e458062d7ce913c14c063b63f4a76f5f4f15782f1eccad31d925eb117c83303b83069b93f4b33a57652e7aa1e81
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gloomhaven (1.0.5)
4
+ gloomhaven (1.0.6)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/changelog.md CHANGED
@@ -1,3 +1,6 @@
1
+ - Updated changelog path
2
+ - Added player validations for class, name
3
+
1
4
  # 1.0.5
2
5
  - Updated error message for Player creation to list valid types
3
6
 
data/gloomhaven.gemspec CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
 
18
18
  # spec.metadata["homepage_uri"] = spec.homepage
19
19
  spec.metadata["source_code_uri"] = "https://github.com/teoucsb82/gloomhaven"
20
- spec.metadata["changelog_uri"] = "https://github.com/teoucsb82/gloomhaven/changelog.md"
20
+ spec.metadata["changelog_uri"] = "https://github.com/teoucsb82/gloomhaven/blob/master/changelog.md"
21
21
 
22
22
  # Specify which files should be added to the gem when it is released.
23
23
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -5,7 +5,7 @@ module Gloomhaven
5
5
  attr_accessor :gold, :items, :perks, :xp
6
6
 
7
7
  def initialize(options = { character_class: nil, name: nil } )
8
- validate_character_class!(options[:character_class])
8
+ validate!(options)
9
9
 
10
10
  @character_class = options[:character_class].downcase
11
11
  @deck = Deck.new
@@ -18,7 +18,7 @@ module Gloomhaven
18
18
 
19
19
  def add_perk!(perk)
20
20
  raise TypeError.new('Perk must be a Gloomhaven::Perk') unless perk.is_a?(Gloomhaven::Perk)
21
- raise ArgumentError.new("#{character_class} cannot select #{perk.description}") unless available_perks.include?(perk.key)
21
+ raise ArgumentError.new("#{character_class} cannot select #{perk.description}. Must be one of the following: #{character_class_perks}") unless character_class_perks.include?(perk.key)
22
22
  raise ArgumentError.new("#{character_class} has the maximum number of #{perk.description} perks") if existing_perk_count(perk) >= character_perk_limit(perk)
23
23
  update_attack_modifier_deck_from!(perk)
24
24
  @perks << perk
@@ -26,7 +26,7 @@ module Gloomhaven
26
26
 
27
27
  private
28
28
 
29
- def available_perks
29
+ def character_class_perks
30
30
  CHARACTERS[character_class]['perks'].keys
31
31
  end
32
32
 
@@ -43,6 +43,11 @@ module Gloomhaven
43
43
  perk.cards['remove'].each { |card| deck.remove!(card) }
44
44
  end
45
45
 
46
+ def validate!(options)
47
+ validate_character_class!(options[:character_class])
48
+ validate_name!(options[:name])
49
+ end
50
+
46
51
  def validate_character_class!(character_class)
47
52
  raise ArgumentError.new("options[:character_class] cannot be blank") if character_class.nil?
48
53
 
@@ -50,5 +55,10 @@ module Gloomhaven
50
55
  raise TypeError.new("Invalid character_class: #{character_class} is not supported. Must be one of the following: #{Gloomhaven::CHARACTERS.keys}")
51
56
  end
52
57
  end
58
+
59
+ def validate_name!(name)
60
+ raise ArgumentError.new("options[:name] cannot be blank") if name.nil?
61
+ raise ArgumentError.new("options[:name] must be a String") unless name.is_a?(String)
62
+ end
53
63
  end
54
64
  end
@@ -1,3 +1,3 @@
1
1
  module Gloomhaven
2
- VERSION = '1.0.5'
2
+ VERSION = '1.0.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gloomhaven
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Teo Dell'Amico
@@ -113,7 +113,7 @@ licenses:
113
113
  - MIT
114
114
  metadata:
115
115
  source_code_uri: https://github.com/teoucsb82/gloomhaven
116
- changelog_uri: https://github.com/teoucsb82/gloomhaven/changelog.md
116
+ changelog_uri: https://github.com/teoucsb82/gloomhaven/blob/master/changelog.md
117
117
  post_install_message:
118
118
  rdoc_options: []
119
119
  require_paths: