xpose 0.1.2 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/xpose/decorated.rb +7 -0
- data/lib/xpose/exposed.rb +8 -7
- data/lib/xpose/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: 02eea2368bfae7bf652a48cf71db7f0357c8ab25
|
4
|
+
data.tar.gz: 0053e667c4b3ecf3dbf72018b531ac93eaff398d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad476f2c9b6c26494c61a1ad15f2b69a35220e72e756bb699ca2051a275cb04f0f6657b2a75df0586e1c04453f94f6a271a91c781ec3f8124441d178ad1eb208
|
7
|
+
data.tar.gz: 715cda9831883f00b03133bf9c7655412b73ae3e43a44ca93cdadd1b64afed9e268b1358ecb7ad3b48089f69dc910aa2e50993deac29a8f78d8e72550b53d4fa
|
data/lib/xpose/decorated.rb
CHANGED
@@ -5,6 +5,7 @@ module Xpose
|
|
5
5
|
def initialize(**args)
|
6
6
|
@conf = ::Xpose::Configuration.build(args)
|
7
7
|
raise MissingParameter if conf.name.nil?
|
8
|
+
decorate_self if conf.decorate == :self
|
8
9
|
end
|
9
10
|
|
10
11
|
def call(instance)
|
@@ -24,6 +25,12 @@ module Xpose
|
|
24
25
|
|
25
26
|
private
|
26
27
|
|
28
|
+
def decorate_self
|
29
|
+
conf.decorated_name = conf.name
|
30
|
+
conf.decorated_method_name = conf.method_name
|
31
|
+
conf.decorated_instance_variable_name = conf.instance_variable_name
|
32
|
+
end
|
33
|
+
|
27
34
|
def infer(v)
|
28
35
|
if v.respond_to?(:decorate)
|
29
36
|
v.decorate
|
data/lib/xpose/exposed.rb
CHANGED
@@ -63,13 +63,14 @@ module Xpose
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def params
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
66
|
+
return {} unless instance.respond_to?(:params)
|
67
|
+
[
|
68
|
+
"#{instance.params[:action]}_#{conf.singularized_name}_params",
|
69
|
+
"#{conf.singularized_name}_params"
|
70
|
+
].each do |m|
|
71
|
+
return instance.send(m) if instance.respond_to?(m, true)
|
72
|
+
end
|
73
|
+
{}
|
73
74
|
end
|
74
75
|
end
|
75
76
|
end
|
data/lib/xpose/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xpose
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Younes SERRAJ
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|