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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 81e66bd9db8fd263b28a2e98fa3e67d24839000f
4
- data.tar.gz: 9faae608d90fcb69a76c94e824459df60ee054dc
3
+ metadata.gz: 02eea2368bfae7bf652a48cf71db7f0357c8ab25
4
+ data.tar.gz: 0053e667c4b3ecf3dbf72018b531ac93eaff398d
5
5
  SHA512:
6
- metadata.gz: '079cc21d48a0bbf9294f3216309c57b43dbcbbd53cec1924c5e2db17cce7271091b1184427b9af902a9ab450a21268b4f7bca653d8b385b4b190f2a8cc3e61a1'
7
- data.tar.gz: d80ed79bf2eccce9a5c5c01b62bc4aac8f4fc5ef3b7b86943413d1cfc18ddc02faa66f480acc5a66640e9ab32523ea698a1114a6faaf8923b0b7c0308577c5ae
6
+ metadata.gz: ad476f2c9b6c26494c61a1ad15f2b69a35220e72e756bb699ca2051a275cb04f0f6657b2a75df0586e1c04453f94f6a271a91c781ec3f8124441d178ad1eb208
7
+ data.tar.gz: 715cda9831883f00b03133bf9c7655412b73ae3e43a44ca93cdadd1b64afed9e268b1358ecb7ad3b48089f69dc910aa2e50993deac29a8f78d8e72550b53d4fa
@@ -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
@@ -63,13 +63,14 @@ module Xpose
63
63
  end
64
64
 
65
65
  def params
66
- byebug
67
- @params ||=
68
- if instance.respond_to?("#{conf.singularized_name}_params", true)
69
- instance.send("#{conf.singularized_name}_params")
70
- else
71
- {}
72
- end
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
@@ -1,3 +1,3 @@
1
1
  module Xpose
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.5"
3
3
  end
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.2
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-13 00:00:00.000000000 Z
11
+ date: 2018-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler