epimath100 1.6.1 → 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/epimath100/error.class.rb +28 -6
  3. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c7176cc2119ddd8fd46478326a2e8e7328e81ed
4
- data.tar.gz: 51d763dbeba16fac9080d3e9c278b773e0184fd6
3
+ metadata.gz: 9ce717ae1f6e2b5a20d3a7088c46acd0ee17ffc3
4
+ data.tar.gz: ed7640666f35c4cca3f722306b3c9f241b8d4e1a
5
5
  SHA512:
6
- metadata.gz: 9c337597cd579ed3a674481b1fee673e253e0afb33004fb67f2b4ebb0bcf0ea7d1e897e3a74ab9f51b7615888e13c61958e93420dde2194ddea8065b1c37c047
7
- data.tar.gz: b87907b140abd65e8a631fc503bd679370fd8d058b3d90238397852131fcc862151da8933f75b7feb3031243e8ac137d4821e568d9c4ad30c56b0e7f7dd29b55
6
+ metadata.gz: 5c245440ced358787e84422f655c0752aee4dffd8ceea8c5be169fa08f271108055d340ab340aa6ede7ff27a28b9f2f688050d84b612773ee5c80493a4f2589e
7
+ data.tar.gz: e5013b0d26c41f65e97ca074b706afb7d5021da62561d250a7ded34e67b9f4250cf7df1dd7e3c4d3058c20057286dd498d7ba4ba664136a703d7d42604ccc11a
@@ -5,13 +5,15 @@ class Error
5
5
  ERR_HIGH = "Fatal Error"
6
6
  ERR_MEDIUM = "Error"
7
7
  ERR_LOW = "Warning"
8
+ ERR_DEFAULT = "Default"
8
9
  ERR_COLOR_RED = "0;31"
9
10
  ERR_COLOR_GREEN = "0;32"
10
11
  ERR_COLOR_YELLOW = "1;33"
11
12
  ERR_COLOR_BLUE = "0;34"
12
13
  ERR_COLOR_ORANGE = "0;33"
13
14
  @@errors = 0
14
-
15
+ @@error_default = ERR_HIGH
16
+
15
17
  # The function will check if the specified value can be converted to a Numerical value.
16
18
  # == Parameters:
17
19
  # type::
@@ -34,18 +36,34 @@ class Error
34
36
  return false
35
37
  end
36
38
  end
37
-
39
+
40
+ # return @@error_default
41
+ def self.default
42
+ return @@error_default
43
+ end
44
+
45
+ # set @@error_default
46
+ def self.default=(level)
47
+ if level != Error::ERR_HIGH and level != Error::ERR_MEDIUM and level != Error::ERR_LOW
48
+ self.call "Error::default= : error level invalid", Error::ERR_MEDIUM
49
+ @@error_default = Error::ERR_HIGH
50
+ else
51
+ @@error_default = level
52
+ end
53
+ end
54
+
38
55
  # "call" is a function you can acces with:
39
56
  # Error.call "message", ERR_LEVEL
40
57
  # == The error's levels are :
41
58
  # * ERR_HIGH
42
59
  # * ERR_MEDIUM
43
60
  # * ERR_LOW
61
+ # * ERR_DEFAULT
44
62
  # The error's level influence the color (visibility) and defined if the programm must exit.
45
63
  # An ERR_HIGH is only to call exit and stop the programm. So be carrefull.
46
64
  # ERR_MEDIUM and ERR_LOW will just display the message and no more.
47
- # ERR_HIGH is the default value, you can change it if yo want
48
- # def self.call m, level=ERR_MEDIUM
65
+ # ERR_HIGH is the default value, you can change it if yo want by :
66
+ # Error.default = Error::ERR_X
49
67
  #
50
68
  # == Parameters:
51
69
  # m::
@@ -56,8 +74,12 @@ class Error
56
74
  #
57
75
  # == Returns:
58
76
  # nil
59
- def self.call m, level=Error::ERR_HIGH
60
-
77
+ def self.call m, level=Error::ERR_DEFAULT
78
+ # define the default value if level is set by "Default"
79
+ if level == Error::ERR_DEFAULT
80
+ level = @@error_default
81
+ end
82
+
61
83
  if level != Error::ERR_HIGH and level != Error::ERR_MEDIUM and level != Error::ERR_LOW
62
84
  self.call "Error::call : error level invalid", Error::ERR_MEDIUM
63
85
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epimath100
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - poulet_a
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-01-19 00:00:00.000000000 Z
14
+ date: 2014-02-23 00:00:00.000000000 Z
15
15
  dependencies: []
16
16
  description: A simple hello world gem
17
17
  email:
@@ -44,17 +44,17 @@ require_paths:
44
44
  - lib
45
45
  required_ruby_version: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - '>='
47
+ - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: '0'
50
50
  required_rubygems_version: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  requirements: []
56
56
  rubyforge_project:
57
- rubygems_version: 2.2.1
57
+ rubygems_version: 2.2.0.rc.1
58
58
  signing_key:
59
59
  specification_version: 4
60
60
  summary: EpiMath100, a ruby gem lib to use lines, functions, points, ...