simple_interaction-rails 0.0.4 → 0.0.5

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: 3f73a6c62c3dec5940828a799f898dca69365ff1
4
- data.tar.gz: d70fd2748664ae4413bdcaa4f5036fbbc752b9ed
3
+ metadata.gz: f0e6315bbd7605db010658f6ecc1cc2c6d365a3c
4
+ data.tar.gz: 06f396e5be303fd7ed92465197240ad4d55e5993
5
5
  SHA512:
6
- metadata.gz: 9a78336e7023fe1b544d57015b7d9a51c0a7e951695727a251bc9cb170aefb8d2620c927765c30d79776f7707070105a4689d7d3ac1dbd638febe4bad0ab7275
7
- data.tar.gz: 2ff6dc9358f4f6ed5c1439c3f4947fd3110b6c80359ef8bd542cfd2986f8fd9a812095428d471bccf05aeb23986295a691dc062a3601bc9909d0ee25e76629c8
6
+ metadata.gz: 8fe39d9661eff41f6effccb3087af5d1259a57582dd8844ce3ff2151ad3560987cd996167a62341ac6f64997f4acdd417afa4e32d6ed9f2e8d6d200b97af828f
7
+ data.tar.gz: 4cecd7a8090b02e854f685db42a14c525b7be8fcd647f33651ac7f90301586ee7938bf3b4c53f68f7ad7cbf7fdbad767618f5efd4ec7de1380e22c017d2945d9
data/README.md CHANGED
@@ -2,7 +2,9 @@
2
2
 
3
3
  This is a work in progress tests are missing!
4
4
 
5
- This simply add a generator to your rails app to create interaction files
5
+ This simply add a generator to your rails app to create interaction files with
6
+ https://github.com/boza/interaction
7
+
6
8
 
7
9
  ## Installation
8
10
 
@@ -17,17 +17,26 @@ class InteractionGenerator < ::Rails::Generators::NamedBase
17
17
  end
18
18
 
19
19
  def interaction_namespaced(&block)
20
- namespaces = class_path.reverse.map do |module_name|
21
- build_namespaces(module_name)
22
- end
23
20
  content = capture(&block)
21
+ content = wrap_in_namespaces(content)
24
22
  content = wrap_with_namespace(content) if namespaced?
25
- content = indent(content).chomp
26
- content = namespaces.reduce {|mod, memo| memo % mod } % content
27
23
  concat(content)
28
24
  end
29
25
 
30
- def build_namespaces(module_name)
26
+ def wrap_in_namespaces(content)
27
+ namespaces = build_namespaces
28
+ return content unless namespaces.any?
29
+ content = indent(content, namespaces.size * 2).chomp
30
+ namespaces.reduce {|mod, memo| memo % indent(mod).chomp } % content
31
+ end
32
+
33
+ def build_namespaces
34
+ class_path.reverse.map do |module_name|
35
+ namespaces_layout(module_name)
36
+ end
37
+ end
38
+
39
+ def namespaces_layout(module_name)
31
40
  "module #{module_name.camelize}\n%s\nend\n"
32
41
  end
33
42
 
@@ -1,5 +1,5 @@
1
1
  module SimpleInteraction
2
2
  module Rails
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_interaction-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jose Boza
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-17 00:00:00.000000000 Z
11
+ date: 2015-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler