goku 0.3 → 0.4

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
  SHA1:
3
- metadata.gz: aacb8d1b49ad8d9479b91feb8c4a87590f90788e
4
- data.tar.gz: a652393694032fb11062cb42467f504496e507a7
3
+ metadata.gz: 8904c9074e9d8ced1c6a98d418c8d6903c5cce8c
4
+ data.tar.gz: 1003b497bafc10713a370edf75571c7289bcaaa1
5
5
  SHA512:
6
- metadata.gz: a7f5250939eef640e7270dabf86fa11c8fe5cdb2bb65a32d93efdf5b2a1aa7635ebd343fc7a5d99721d1903705606cb1084cb75ad5dc6e7a10cd4351daaee371
7
- data.tar.gz: a23dd96c3d75a7557be75e1a3f79de501661c7e4a2e0a8dce13c486c15710e285cda0662229c28240522c4cfab5e287634bea884d5cf22171f136c1603835cbe
6
+ metadata.gz: e4e0853efc58dda7190ca7a3456d5001a7d85e4870f3b7338d7247506ac11d6e3c1677ee35b1a4c5911e669f70a6ecd1fd96fa2d86f863d00a60a83e930961ae
7
+ data.tar.gz: 6bb0f6fb4657c6a56080a5d9441a90ebf7407d8522c82a25427b54d16963fbcc546911a5f61f219b03f7fb0c8ef28499f8f3fcb58ab78e5053c464f2426ad218
@@ -5,18 +5,9 @@ module Goku
5
5
  def c(raw_path)
6
6
  path = Goku::Path.new(raw_path)
7
7
 
8
- modules = path.directories.drop(1).map do |module_name|
9
- Goku::Factories::Module.new(module_name)
10
- end
11
-
12
- klass = Goku::Factories::Class.new(path.filename)
13
- klass.add(Goku::Factories::Method.new("initialize"))
8
+ modules = create_modules(path)
14
9
 
15
- modules.last.add(klass)
16
-
17
- modules.reverse.each_cons(2) do |submodule, parent_module|
18
- parent_module.add(submodule)
19
- end
10
+ modules.last.add(Goku::Factories::Class.new(path.filename))
20
11
 
21
12
  puts modules.first.to_s
22
13
  end
@@ -25,12 +16,26 @@ module Goku
25
16
  def m(raw_path)
26
17
  path = Goku::Path.new(raw_path)
27
18
 
28
- mod = Goku::Factories::Module.new(path.filename)
19
+ modules = create_modules(path)
29
20
 
30
- puts mod
21
+ modules.last.add(Goku::Factories::Module.new(path.filename))
22
+
23
+ puts modules.first.to_s
31
24
  end
32
25
 
33
26
  map "module" => "m"
34
27
  map "class" => "m"
28
+
29
+ private
30
+
31
+ def create_modules(path)
32
+ modules = path.directories.drop(1).map { |m| Goku::Factories::Module.new(m) }
33
+
34
+ modules.reverse.each_cons(2) do |submodule, parent_module|
35
+ parent_module.add(submodule)
36
+ end
37
+
38
+ modules
39
+ end
35
40
  end
36
41
  end
@@ -2,6 +2,14 @@ module Goku
2
2
  module Factories
3
3
  class Class < Base
4
4
 
5
+ def initialize(name)
6
+ super
7
+
8
+ initializer = Goku::Factories::Method.new("initialize")
9
+
10
+ add(initializer)
11
+ end
12
+
5
13
  def to_s
6
14
  "class #{name.camelcase}\n#{super}\nend"
7
15
  end
@@ -1,3 +1,3 @@
1
1
  module Goku
2
- VERSION = "0.3"
2
+ VERSION = "0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: goku
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.3'
4
+ version: '0.4'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Šarčević