spinning_wheel 0.1.0 → 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
  SHA256:
3
- metadata.gz: 898b043353fda422c4c8f069954e83a0def2a5436027ec8161f15efdcccb1b3c
4
- data.tar.gz: 2b9590e7f620ab5a6893faef4f6c9827b14aaa6d5b92bce7341c12e4c8293986
3
+ metadata.gz: fff05d6c4dbc077be363d0eed3ce45139f6ccd61587c6620edff5ea819fb82f8
4
+ data.tar.gz: a638c94cee140bd3f49b4aaee6537ec9f708d11b703fb2863bd424c952c830dc
5
5
  SHA512:
6
- metadata.gz: 4e16c81342527a7861c29ce98533f3de448a740ac1b05241a86ce55837cbcdb32cd24134af548343368bac989a35282a540aef5d4e70242abd8992a9574e51c2
7
- data.tar.gz: 5e6edcc4debb99f38ff9ee0cc1e2e7e3453f463320b6e66a92d55c8fe20e2317e2eddebcddb478477fc8eec373c392a090a1ca19daeb898659ae5a8ff61c005f
6
+ metadata.gz: 3848af072ab30a05eb8fbfd29796240a22f8995fa36a91f6aa53f3223b93b27d8035d9c7d4bc32f7b2e6b506a41c094f13d711c912a091661ea335ff74fbe16d
7
+ data.tar.gz: c629fecbf4abe56b65ab97d282cc4ec721f5f87dd3e616b16655b75b3906939bc1b9046b44ecbf9175a318b2de3d2beaf7c4082b381fd8c65641096fc580a239
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.5.1
data/Gemfile.lock CHANGED
@@ -16,6 +16,7 @@ GEM
16
16
  concurrent-ruby (1.1.5)
17
17
  diff-lcs (1.3)
18
18
  equatable (0.5.0)
19
+ ffi (1.11.1-java)
19
20
  i18n (1.6.0)
20
21
  concurrent-ruby (~> 1.0)
21
22
  method_source (0.9.2)
@@ -27,6 +28,10 @@ GEM
27
28
  pry (0.12.2)
28
29
  coderay (~> 1.1.0)
29
30
  method_source (~> 0.9.0)
31
+ pry (0.12.2-java)
32
+ coderay (~> 1.1.0)
33
+ method_source (~> 0.9.0)
34
+ spoon (~> 0.0)
30
35
  rake (10.5.0)
31
36
  rspec (3.8.0)
32
37
  rspec-core (~> 3.8.0)
@@ -41,7 +46,10 @@ GEM
41
46
  diff-lcs (>= 1.2.0, < 2.0)
42
47
  rspec-support (~> 3.8.0)
43
48
  rspec-support (3.8.0)
49
+ spoon (0.0.6)
50
+ ffi
44
51
  thread_safe (0.3.6)
52
+ thread_safe (0.3.6-java)
45
53
  timers (4.3.0)
46
54
  tty-color (0.4.3)
47
55
  tty-cursor (0.6.1)
@@ -61,6 +69,7 @@ GEM
61
69
  wisper (2.0.0)
62
70
 
63
71
  PLATFORMS
72
+ java
64
73
  ruby
65
74
 
66
75
  DEPENDENCIES
@@ -72,4 +81,4 @@ DEPENDENCIES
72
81
  tty-prompt (~> 0.18)
73
82
 
74
83
  BUNDLED WITH
75
- 1.16.3
84
+ 1.17.2
@@ -19,14 +19,3 @@ module SpinningWheel
19
19
  @fabrics[fabric.name] = fabric
20
20
  end
21
21
  end
22
-
23
- # def initialize(&block)
24
- # instance_eval(&block)
25
- # end
26
-
27
- # def fabric(options, &block)
28
- # fabric
29
- # # fabric = SpinningWheel::Fabric.new(options)
30
- # # object = fabric.create(&block)
31
- # # register(fabric.name, object)
32
- # end
@@ -6,13 +6,12 @@ module SpinningWheel
6
6
  def initialize(name:, class_name:, &block)
7
7
  @name = name
8
8
  @class_name = class_name
9
- @attributes = {}
10
9
  @block = block
11
10
  end
12
11
 
13
12
  def build
14
13
  @klass = @class_name.constantize
15
- instance_eval(&@block)
14
+ attributes = DSL.run(@block)
16
15
  parameters = @klass.instance_method(:initialize).parameters
17
16
  required_parametes = []
18
17
  parameters.each do |parameter|
@@ -20,15 +19,46 @@ module SpinningWheel
20
19
  required_parametes << parameter[1]
21
20
  end
22
21
  end
23
- if required_parametes == @attributes.keys
24
- @klass.new(*@attributes.values)
22
+ if required_parametes == attributes.keys
23
+ @klass.new(*attributes.values)
25
24
  else
26
- @klass.new(**@attributes)
25
+ @klass.new(**attributes)
27
26
  end
28
27
  end
29
28
 
30
- def method_missing(name, *args, &block)
31
- @attributes[name] = block.call
29
+
30
+ class DSL
31
+
32
+ attr_accessor :attributes
33
+
34
+ def self.run(block)
35
+ dsl = self.new
36
+ dsl.instance_eval(&block)
37
+ return dsl.attributes
38
+ end
39
+
40
+ def initialize()
41
+ @attributes = Hash.new
42
+ clean_up_object_methods()
43
+ end
44
+
45
+ def method_missing(name, *args, &block)
46
+ @attributes[name] = block.call
47
+ end
48
+
49
+ private
50
+
51
+ def clean_up_object_methods
52
+ self.instance_eval('undef :clone')
53
+ self.instance_eval('undef :display')
54
+ self.instance_eval('undef :dup')
55
+ self.instance_eval('undef :extend')
56
+ self.instance_eval('undef :freeze')
57
+ self.instance_eval('undef :frozen?')
58
+ self.instance_eval('undef :inspect')
59
+ self.instance_eval('undef :taint')
60
+ self.instance_eval('undef :tap')
61
+ end
32
62
  end
33
63
 
34
64
  end
@@ -1,3 +1,3 @@
1
1
  module SpinningWheel
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
Binary file
metadata CHANGED
@@ -1,16 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spinning_wheel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Langenegger
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-21 00:00:00.000000000 Z
11
+ date: 2019-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
+ name: activesupport
14
15
  requirement: !ruby/object:Gem::Requirement
15
16
  requirements:
16
17
  - - "~>"
@@ -19,9 +20,8 @@ dependencies:
19
20
  - - ">="
20
21
  - !ruby/object:Gem::Version
21
22
  version: 5.0.0.0
22
- name: activesupport
23
- prerelease: false
24
23
  type: :runtime
24
+ prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
@@ -31,70 +31,70 @@ dependencies:
31
31
  - !ruby/object:Gem::Version
32
32
  version: 5.0.0.0
33
33
  - !ruby/object:Gem::Dependency
34
+ name: bundler
34
35
  requirement: !ruby/object:Gem::Requirement
35
36
  requirements:
36
37
  - - "~>"
37
38
  - !ruby/object:Gem::Version
38
39
  version: '1.16'
39
- name: bundler
40
- prerelease: false
41
40
  type: :development
41
+ prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
46
  version: '1.16'
47
47
  - !ruby/object:Gem::Dependency
48
+ name: rake
48
49
  requirement: !ruby/object:Gem::Requirement
49
50
  requirements:
50
51
  - - "~>"
51
52
  - !ruby/object:Gem::Version
52
53
  version: '10.0'
53
- name: rake
54
- prerelease: false
55
54
  type: :development
55
+ prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
60
  version: '10.0'
61
61
  - !ruby/object:Gem::Dependency
62
+ name: rspec
62
63
  requirement: !ruby/object:Gem::Requirement
63
64
  requirements:
64
65
  - - "~>"
65
66
  - !ruby/object:Gem::Version
66
67
  version: '3.0'
67
- name: rspec
68
- prerelease: false
69
68
  type: :development
69
+ prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
74
  version: '3.0'
75
75
  - !ruby/object:Gem::Dependency
76
+ name: pry
76
77
  requirement: !ruby/object:Gem::Requirement
77
78
  requirements:
78
79
  - - "~>"
79
80
  - !ruby/object:Gem::Version
80
81
  version: 0.12.0
81
- name: pry
82
- prerelease: false
83
82
  type: :development
83
+ prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
88
  version: 0.12.0
89
89
  - !ruby/object:Gem::Dependency
90
+ name: tty-prompt
90
91
  requirement: !ruby/object:Gem::Requirement
91
92
  requirements:
92
93
  - - "~>"
93
94
  - !ruby/object:Gem::Version
94
95
  version: '0.18'
95
- name: tty-prompt
96
- prerelease: false
97
96
  type: :development
97
+ prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - "~>"
@@ -109,6 +109,7 @@ extra_rdoc_files: []
109
109
  files:
110
110
  - ".gitignore"
111
111
  - ".rspec"
112
+ - ".ruby-version"
112
113
  - ".travis.yml"
113
114
  - Gemfile
114
115
  - Gemfile.lock
@@ -121,12 +122,13 @@ files:
121
122
  - lib/spinning_wheel/fabric.rb
122
123
  - lib/spinning_wheel/syntax.rb
123
124
  - lib/spinning_wheel/version.rb
125
+ - spinning_wheel-0.1.0.gem
124
126
  - spinning_wheel.gemspec
125
127
  homepage: https://fadendaten.ch
126
128
  licenses:
127
129
  - MIT
128
130
  metadata: {}
129
- post_install_message:
131
+ post_install_message:
130
132
  rdoc_options: []
131
133
  require_paths:
132
134
  - lib
@@ -141,9 +143,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
143
  - !ruby/object:Gem::Version
142
144
  version: '0'
143
145
  requirements: []
144
- rubyforge_project:
146
+ rubyforge_project:
145
147
  rubygems_version: 2.7.6
146
- signing_key:
148
+ signing_key:
147
149
  specification_version: 4
148
150
  summary: Write a short summary, because RubyGems requires one.
149
151
  test_files: []