musa-dsl 0.23.8 → 0.23.9

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
  SHA256:
3
- metadata.gz: aedf1b2e55be310702169b869ff68a41c79d0d787002b21918c096ad18373dcf
4
- data.tar.gz: 4bc6bd9694bffe3c97040e2d33e4a451accdeb5e621346c030fc699c2325ba5d
3
+ metadata.gz: 79f0b29dc4afd60274d8c1e5727ae70d3233b91a004a0173b57e398f152dcf56
4
+ data.tar.gz: 7538b77296f7185211e56b344bd3d332afb6de8b2cfa95b166737830a524c68b
5
5
  SHA512:
6
- metadata.gz: 30173d87a84a7d4288ddd00f5b212a9178f6f1836f673972f4c29c6528d57231588c4e9152ce06ba24319e834aac087a25f793ca8bf862d83d8bfae898c7d620
7
- data.tar.gz: de0f34c68858de9629d2e65f9c0d794c2bb122855716476130b35f921297b731facd1b039c339235ec7168bedafa1652611722cc9ac684e3f66748b5275fa101
6
+ metadata.gz: 91d9441bc8fb61321764876d90c7ac8079a475e4dd9ce4c12184e3262a7682bdce2cd5d66e272daa2e1e1233734d46bb9bda6232522781ab40e07f27ae5a51e7
7
+ data.tar.gz: c20a18071678dd0c68567de8a2f1b1b8b1a2fe1cf5d541b99bef712bce79385172e2102219d484acb5e131b25e52a94081e866c56b28736da244a48ead7d78b0
@@ -48,10 +48,14 @@ module Musa
48
48
  ForLoop.new from, to, step
49
49
  end
50
50
 
51
- def RND(*values, from: nil, to: nil, step: nil, random: nil)
51
+ def RND(*_values, values: nil, from: nil, to: nil, step: nil, random: nil)
52
+ raise ArgumentError, "Can't use both direct values #{_values} and values named parameter #{values} at the same time." if values && !_values.empty?
53
+
52
54
  random = Random.new random if random.is_a?(Integer)
53
55
  random ||= Random.new
54
56
 
57
+ values ||= _values
58
+
55
59
  if !values.empty? && from.nil? && to.nil? && step.nil?
56
60
  RandomValuesFromArray.new values.explode_ranges, random
57
61
  elsif values.empty? && !to.nil?
@@ -67,10 +71,14 @@ module Musa
67
71
  Sequence.new(series)
68
72
  end
69
73
 
70
- def RND1(*values, from: nil, to: nil, step: nil, random: nil)
74
+ def RND1(*_values, values: nil, from: nil, to: nil, step: nil, random: nil)
75
+ raise ArgumentError, "Can't use both direct values #{_values} and values named parameter #{values} at the same time." if values && !_values.empty?
76
+
71
77
  random = Random.new random if random.is_a?(Integer)
72
78
  random ||= Random.new
73
79
 
80
+ values ||= _values
81
+
74
82
  if !values.empty? && from.nil? && to.nil? && step.nil?
75
83
  RandomValueFromArray.new values.explode_ranges, random
76
84
  elsif values.empty? && !to.nil?
@@ -282,9 +282,18 @@ module Musa
282
282
  when Proc
283
283
  call_constructor_according_to_last_and_parameter(last.call, constructor, parameter)
284
284
 
285
+ when UndefinedSerie
286
+ case parameter
287
+ when Hash
288
+ Musa::Series::Constructors.method(constructor).call(**parameter)
289
+ when Array
290
+ Musa::Series::Constructors.method(constructor).call(*parameter)
291
+ else
292
+ raise "Unexpected parameter #{parameter} for constructor #{constructor}"
293
+ end
294
+
285
295
  when Serie
286
- # TODO: ignoring last, should make an error?
287
- Musa::Series::Constructors.method(constructor).call(*parameter)
296
+ raise "Unexpected source serie #{last} for constructor #{constructor}"
288
297
 
289
298
  when nil
290
299
  Musa::Series::Constructors.method(constructor).call(*parameter)
data/musa-dsl.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'musa-dsl'
3
- s.version = '0.23.8'
3
+ s.version = '0.23.9'
4
4
  s.date = '2021-08-03'
5
5
  s.summary = 'A simple Ruby DSL for making complex music'
6
6
  s.description = 'Musa-DSL: A Ruby framework and DSL for algorithmic sound and musical thinking and composition'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: musa-dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.8
4
+ version: 0.23.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javier Sánchez Yeste