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 +4 -4
- data/README.md +3 -1
- data/lib/generators/interaction_generator.rb +15 -6
- data/lib/simple_interaction/rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0e6315bbd7605db010658f6ecc1cc2c6d365a3c
|
4
|
+
data.tar.gz: 06f396e5be303fd7ed92465197240ad4d55e5993
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
|
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
|
+
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-
|
11
|
+
date: 2015-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|