ogem 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 405237dd45ec8718e1e912144722455c18b3c5a3
4
- data.tar.gz: 3da04ba666b20b45afb8946fac4a26bfcdf700f7
3
+ metadata.gz: 688314260efcab0747741a86f7c1a2b8a66aede0
4
+ data.tar.gz: 26f1b265bca5b98dca65b2fddb10a8eef12b978d
5
5
  SHA512:
6
- metadata.gz: 78210c730ca95f1ac5dd9a10800d29b7a848d4a2089027f21570e2a23a5c9f6a493772693b7c6837e7551215e6866cab0241acedf4b3c08001bc4acde78bae4b
7
- data.tar.gz: ce550989fab597d7a73501c958346d9129a2b893149b44bdffb302f14fc9bfa1bec7e0918e9f980407b7d319e0f926a1d00541b125feec71af0a0f145c69ddef
6
+ metadata.gz: 04d58a67cb49ca15614e6a429d3bca5ac8c8f6d42785da6169c5a031bc8cfd2647efd637bbd223fb43eba867ae10fcb3263bb67712b66dc02340eb9f03c2a998
7
+ data.tar.gz: b1eb81a0f591010ef0a8b7805506ef6a3bb663895c7603c239dd0f50065baaab4e36f61f4107f67104afcdb8a0030de56c8f7e4b7e1f344e5a9f7d239231007c
@@ -3,7 +3,7 @@
3
3
  require_relative 'ship.class'
4
4
  require_relative 'player.class'
5
5
 
6
- module OgameCalc
6
+ module Ogem
7
7
 
8
8
  SHIP_LIST = {
9
9
  light_fighter: Ship.new("Chasseur léger", "cl", 3000, 1000, 0),
@@ -2,13 +2,13 @@
2
2
 
3
3
  gem 'myerror'
4
4
 
5
- module OgameCalc
5
+ module Ogem
6
6
  class Player
7
7
  attr_accessor :name, :r
8
8
 
9
9
  def initialize name="Player", m=1000, c=1000, d=0
10
10
  if !name.is_a?String
11
- Error.call "OgameCalc::Player::new : invalid name", Error::ERR_MEDIUM
11
+ Error.call "Ogem::Player::new : invalid name", Error::ERR_MEDIUM
12
12
  name = "Player"
13
13
  end
14
14
 
@@ -2,20 +2,20 @@
2
2
 
3
3
  gem 'myerror'
4
4
 
5
- module OgameCalc
5
+ module Ogem
6
6
  class Ship
7
7
  attr_reader :name, :r, :abv
8
8
 
9
9
  def initialize name="Ship", abv="", m=3000, c=1000, d=0
10
10
  if !name.is_a?String
11
- Error.call "OgameCalc::Ship::new : invalid name", Error::ERR_MEDIUM
11
+ Error.call "Ogem::Ship::new : invalid name", Error::ERR_MEDIUM
12
12
  name = "UnknowShip"
13
- elsif !abv.is_a?String
14
- Error.call "OgameCalc::Ship::new : invalid abv", Error::ERR_MEDIUM
13
+ elsif !abv.is_a?String and !abv.is_a?Symbol
14
+ Error.call "Ogem::Ship::new : invalid abv", Error::ERR_MEDIUM
15
15
  name = "unknow"
16
16
  end
17
17
  @name = name
18
- @abv = abv
18
+ @abv = abv.to_sym
19
19
  @r = {m: m.to_i, c: c.to_i, d: d.to_i}
20
20
  end
21
21
 
@@ -29,14 +29,14 @@ module OgameCalc
29
29
 
30
30
  def cost
31
31
  line = ""
32
- OgameCalc::RESOURCES.each do |k, v|
32
+ Ogem::RESOURCES.each do |k, v|
33
33
  line += "\t<#{v}:#{@r[k]}>"
34
34
  end
35
35
  return line
36
36
  end
37
37
 
38
38
  def self.get_abv abv
39
- OgameCalc::SHIP_LIST.each do |k, ship|
39
+ Ogem::SHIP_LIST.each do |k, ship|
40
40
  Error.call "Ship::self.get_abv : Invalid element #{ship}" if !ship.is_a?Ship
41
41
  return ship if ship.abv == abv
42
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ogem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - poulet_a