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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c5349c64edaf35926e0cf79fbf375be1fe99aac4
4
- data.tar.gz: fac2d88e71258296e20085dfd17cb82441b64de8
3
+ metadata.gz: f5e2d012e6282ea96916d61a87865eb0b0011b3d
4
+ data.tar.gz: 497a52b5ff6353cb6bca2960591c30b22fc8207c
5
5
  SHA512:
6
- metadata.gz: 179f30aec3b466475c5066574292afff1bfd356cedaa603f486226e09101be74aeea1358d4a982038710a649bd0e91801ab03280347e57c22272df257eb2bd3b
7
- data.tar.gz: f5011dc156617cde6570de9c785f9629b0995c47810ef8a3222e694a3258f5256e8fa5b39ef0d33b24a4a7220bd796d1e9003375140e99e5522b6ed75d7d6ca7
6
+ metadata.gz: be74f6da17fbbe9409aeee39ef1df630de58b03f4e8263eb2fc2de30941391cfb96dc345e674673468db9253155af4b2346481fe78e785ceea60f8ce1c386ea2
7
+ data.tar.gz: f5a417bead73c2893a0ade5fd1facf5436c744b02c359346b4cddba426d85b23d9a15c8bc7d0030e095ba29746dac1532e7ceda36c13af8a26239897870e1fdc
data/lib/goku.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "thor"
2
2
  require "active_support/all"
3
3
 
4
+ require "goku/factories/base"
4
5
  require "goku/factories/method"
5
6
  require "goku/factories/class"
6
7
  require "goku/factories/module"
@@ -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
@@ -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
- strigified_methods = methods
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,12 +1,6 @@
1
1
  module Goku
2
2
  module Factories
3
- class Method
4
-
5
- attr_reader :name
6
-
7
- def initialize(name)
8
- @name = name
9
- end
3
+ class Method < Base
10
4
 
11
5
  def to_s
12
6
  "def #{name}\nend"
@@ -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
- strigified_methods = methods
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
@@ -1,3 +1,3 @@
1
1
  module Goku
2
- VERSION = "0.2"
2
+ VERSION = "0.2.1"
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.2'
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