mumukit-randomizer 0.1.0 → 1.0.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
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ee83d6d1af0083b2f474908e9b242b984492f531c3fc2b36a38633fb6fb042cd
|
4
|
+
data.tar.gz: 2c8e67e56237aef5a0d7ea9111bcecc4c9ab3c09d7eb36c55b06efab4f09cf8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d95e2e5dfd21c146481714ddea4feac7f8dc1bc9c003c32e9bc90e460d28cf01039fa4fde96414f2cbcf66d362051a5a954c1f871a19235f797acd71c4a1497c
|
7
|
+
data.tar.gz: b66fc9ace487ded967261b19f1fce93f8f0e6fb68293e487b4919725cd901eff0d991f3b729d36556a6e81e55f90f81baabdeadc9a922eb7a4eb88804f376e8b
|
@@ -7,7 +7,7 @@ module Mumukit::Randomizer::Randomization
|
|
7
7
|
|
8
8
|
def self.parse(randomization)
|
9
9
|
case randomization[:type].to_sym
|
10
|
-
when :
|
10
|
+
when :one_of then Mumukit::Randomizer::Randomization::OneOf.new randomization[:value]
|
11
11
|
when :range then Mumukit::Randomizer::Randomization::Range.new(*randomization[:value])
|
12
12
|
else raise 'Unsupported randomization kind'
|
13
13
|
end
|
data/lib/mumukit/randomizer.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumukit-randomizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julián Berbel Alt
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-07-
|
12
|
+
date: 2018-07-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -81,7 +81,6 @@ files:
|
|
81
81
|
- lib/mumukit/randomizations/range.rb
|
82
82
|
- lib/mumukit/randomizer.rb
|
83
83
|
- lib/mumukit/randomizer/version.rb
|
84
|
-
- lib/mumukit/randomizer/with_randomizations.rb
|
85
84
|
homepage: http://github.com/mumuki/mumukit-randomizer
|
86
85
|
licenses:
|
87
86
|
- MIT
|
@@ -102,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
101
|
version: '0'
|
103
102
|
requirements: []
|
104
103
|
rubyforge_project:
|
105
|
-
rubygems_version: 2.
|
104
|
+
rubygems_version: 2.7.7
|
106
105
|
signing_key:
|
107
106
|
specification_version: 4
|
108
107
|
summary: Library for randomizing parts of mumuki exercises
|
@@ -1,34 +0,0 @@
|
|
1
|
-
module WithRandomizations
|
2
|
-
extend ActiveSupport::Concern
|
3
|
-
|
4
|
-
included do
|
5
|
-
serialize :randomizations, Hash
|
6
|
-
end
|
7
|
-
|
8
|
-
def seed
|
9
|
-
@seed || 0
|
10
|
-
end
|
11
|
-
|
12
|
-
def seed_with!(seed)
|
13
|
-
@seed = seed
|
14
|
-
end
|
15
|
-
|
16
|
-
def randomizer
|
17
|
-
@randomizer ||= Mumukit::Randomizer.parse(randomizations)
|
18
|
-
end
|
19
|
-
|
20
|
-
module ClassMethods
|
21
|
-
def randomize(*selectors)
|
22
|
-
selectors.each { |selector| randomize_field selector }
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
def randomize_field(selector)
|
28
|
-
define_method(selector) do |*args|
|
29
|
-
return unless super(*args)
|
30
|
-
randomizer.randomize!(super(*args), seed)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|