goku 0.2 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/goku.rb +1 -0
- data/lib/goku/factories/base.rb +23 -0
- data/lib/goku/factories/class.rb +2 -19
- data/lib/goku/factories/method.rb +1 -7
- data/lib/goku/factories/module.rb +2 -19
- data/lib/goku/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5e2d012e6282ea96916d61a87865eb0b0011b3d
|
4
|
+
data.tar.gz: 497a52b5ff6353cb6bca2960591c30b22fc8207c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be74f6da17fbbe9409aeee39ef1df630de58b03f4e8263eb2fc2de30941391cfb96dc345e674673468db9253155af4b2346481fe78e785ceea60f8ce1c386ea2
|
7
|
+
data.tar.gz: f5a417bead73c2893a0ade5fd1facf5436c744b02c359346b4cddba426d85b23d9a15c8bc7d0030e095ba29746dac1532e7ceda36c13af8a26239897870e1fdc
|
data/lib/goku.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
module Goku
|
2
|
+
module Factories
|
3
|
+
class Base
|
4
|
+
|
5
|
+
attr_reader :name
|
6
|
+
attr_reader :elements
|
7
|
+
|
8
|
+
def initialize(name)
|
9
|
+
@name = name
|
10
|
+
@elements = []
|
11
|
+
end
|
12
|
+
|
13
|
+
def add(element)
|
14
|
+
@elements << element
|
15
|
+
end
|
16
|
+
|
17
|
+
def to_s
|
18
|
+
elements.map(&:to_s).map { |el| el.indent(2) }.join("\n\n")
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/goku/factories/class.rb
CHANGED
@@ -1,26 +1,9 @@
|
|
1
1
|
module Goku
|
2
2
|
module Factories
|
3
|
-
class Class
|
4
|
-
|
5
|
-
attr_reader :name
|
6
|
-
attr_reader :methods
|
7
|
-
|
8
|
-
def initialize(name)
|
9
|
-
@name = name
|
10
|
-
@methods = []
|
11
|
-
end
|
12
|
-
|
13
|
-
def add_method(method)
|
14
|
-
@methods << method
|
15
|
-
end
|
3
|
+
class Class < Base
|
16
4
|
|
17
5
|
def to_s
|
18
|
-
|
19
|
-
.map(&:to_s)
|
20
|
-
.map { |method| method.indent(2) }
|
21
|
-
.join("\n\n")
|
22
|
-
|
23
|
-
"class #{name.camelcase}\n\n#{strigified_methods}\n\nend"
|
6
|
+
"class #{name.camelcase}\n\n#{super}\n\nend"
|
24
7
|
end
|
25
8
|
|
26
9
|
end
|
@@ -1,26 +1,9 @@
|
|
1
1
|
module Goku
|
2
2
|
module Factories
|
3
|
-
class Module
|
4
|
-
|
5
|
-
attr_reader :name
|
6
|
-
attr_reader :methods
|
7
|
-
|
8
|
-
def initialize(name)
|
9
|
-
@name = name
|
10
|
-
@methods = []
|
11
|
-
end
|
12
|
-
|
13
|
-
def add_method(method)
|
14
|
-
@methods << method
|
15
|
-
end
|
3
|
+
class Module < Base
|
16
4
|
|
17
5
|
def to_s
|
18
|
-
|
19
|
-
.map(&:to_s)
|
20
|
-
.map { |method| method.indent(2) }
|
21
|
-
.join("\n\n")
|
22
|
-
|
23
|
-
"module #{name.camelcase}\n\n#{strigified_methods}\n\nend"
|
6
|
+
"module #{name.camelcase}\n\n#{super}\n\nend"
|
24
7
|
end
|
25
8
|
|
26
9
|
end
|
data/lib/goku/version.rb
CHANGED
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:
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Šarčević
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- goku.gemspec
|
117
117
|
- lib/goku.rb
|
118
118
|
- lib/goku/cli.rb
|
119
|
+
- lib/goku/factories/base.rb
|
119
120
|
- lib/goku/factories/class.rb
|
120
121
|
- lib/goku/factories/method.rb
|
121
122
|
- lib/goku/factories/module.rb
|