ruby-mext 0.14.0 → 0.15.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8827f153719404c7a58d76841b1035dec8554e0d1352b65a04437d67d53354a4
4
- data.tar.gz: d3815f2309de12f1cc4b5b403709ec04c201a7500fcedc76484c048ad38f38da
3
+ metadata.gz: '09ac64d0fe860b273907466ffa0f6a4662b7210f0822a190820d69a5aaf3f51e'
4
+ data.tar.gz: 5c5d520e102f656a1dea652fd07282453d6af3c70e02d46cf4e3d3146fabd547
5
5
  SHA512:
6
- metadata.gz: 225682bc6a0c772a7aaa8f7136b9411a34aa39ab550158b6b78b8cc25afe7e4f00b3ad42b861c7eecb804b2360bae7cfb70acae3009933b73087ffa5a23fc9eb
7
- data.tar.gz: e992d615c3ae63283e27d2b4187da1d8a2455c703121f89904e944b7158456c4817b529862c85025047fa04e2e54e6c5bfcd0e52ad504081dde6b39d68da150e
6
+ metadata.gz: 647018fa06c2ed3161e6f6f21ab5a0903b4e1e964475dacbe380609d5c23a87ffa0679e7edec9326d75a24ba662bc0b5939e6d9b3d206c9f0172c63e0bb60a3f
7
+ data.tar.gz: a46cb682b5aa14dbd7c36451711b72089327e4b198035662a0467fb990380cbdb7d113a783eea62b9ec303b9f5418604c879c8beda1917e82a65c1a87f6d6b11
@@ -1,5 +1,3 @@
1
- require 'byebug'
2
-
3
1
  module Mext
4
2
 
5
3
  #
@@ -86,6 +84,18 @@ module Mext
86
84
  self.current
87
85
  end
88
86
 
87
+ include Mext::Utilities
88
+
89
+ class << self
90
+
91
+ def from_yaml(ha)
92
+ raise ArgumentError unless ha.kind_of?(Hash) && ha.has_key?('args')
93
+ args = ha['args'].map { |value| value.kind_of?(String) ? eval(value) : value }
94
+ new(args)
95
+ end
96
+
97
+ end
98
+
89
99
  end
90
100
 
91
101
  end
@@ -21,6 +21,7 @@ module Math
21
21
  #
22
22
  #:nodoc:
23
23
  def y(x)
24
+ x
24
25
  end
25
26
 
26
27
  #:doc:
@@ -55,13 +56,12 @@ module Math
55
56
  ''
56
57
  end
57
58
 
58
- class << self
59
-
60
- def from_yaml(yh)
61
- new
62
- end
63
-
64
- end
59
+ #
60
+ # +Mext::Utilities+
61
+ #
62
+ # add several (class) methods like: +from_yaml+
63
+ #
64
+ include Mext::Utilities
65
65
 
66
66
  private
67
67
 
@@ -0,0 +1,32 @@
1
+ module Mext
2
+
3
+ #
4
+ # +Mext::Utilities+
5
+ #
6
+ # add common methods to several +Mext+ library classes.
7
+ #
8
+ # It allows a common interface to several utilities
9
+ #
10
+ module Utilities
11
+
12
+ def self.included(base)
13
+ base.extend ClassMethods
14
+ end
15
+
16
+ module ClassMethods
17
+
18
+ #
19
+ # +from_yaml(yaml_hash)+
20
+ #
21
+ # allows to create from a yaml hash
22
+ #
23
+ def from_yaml(yh)
24
+ args = yh.values
25
+ new(*args)
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+
32
+ end
data/lib/mext.rb CHANGED
@@ -6,6 +6,7 @@ end
6
6
 
7
7
  %w(
8
8
  exceptions
9
+ utilities
9
10
  numeric
10
11
  array
11
12
  math
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mext
2
- VERSION = '0.14.0'
2
+ VERSION = '0.15.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-mext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicola Bernardini
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-10 00:00:00.000000000 Z
11
+ date: 2019-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -148,6 +148,7 @@ files:
148
148
  - lib/mext/numeric/pitch_fork.rb
149
149
  - lib/mext/numeric/rrand.rb
150
150
  - lib/mext/numeric/semitopch.rb
151
+ - lib/mext/utilities.rb
151
152
  - lib/ruby-mext.rb
152
153
  - lib/ruby.rb
153
154
  - lib/ruby/extensions.rb