durable_decorator_rails 0.2.3 → 0.2.4

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: b180b43a6a08fb69fd4b78c2a500df19b4e462d1
4
- data.tar.gz: faead60d5074d047e6e2d5f04b1c0c800a41c527
3
+ metadata.gz: 40cc93cf5f7a6c77feb879bdb3f7f4ebd07242f9
4
+ data.tar.gz: 6f44b966cb7b56d3d707c3380d113299e5e13f41
5
5
  SHA512:
6
- metadata.gz: c55392b5fd7459650eaabddc4960ceea42ae3ddec71573b0a3b73a7d2da7e52cf26a3ff01a45ce71c9c751bc55761263fdd41cebd6d3221d89614a1e4e0f4f3a
7
- data.tar.gz: cc7c104427984503bffa6addf89db464ef881e10749ba345ddb14b02fcfb90df9aa47b9e8ca98a3fa21e67109f857faf07ddf0ae399405a149eda3dc9e0b98a9
6
+ metadata.gz: a0d18e750998df83faaa34cdec97eaedb17619c33b7116254607dba012fd2542ddf93e8a041d826d455cea641d06a293d7e3a914285108d9561ea8e1b26fcbd8
7
+ data.tar.gz: 659c6a3874daea0609f978c3f390bad6b81b7a1460e05abd68005e97d3e1c9a7ab36ff31db563f0873f7addbb1cda19be60b5a0680ae9aeb7c780265fb95f546
@@ -1,3 +1,3 @@
1
1
  module DurableDecoratorRails
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
@@ -63,9 +63,33 @@ private
63
63
 
64
64
  def redefinition_body
65
65
  " durably_decorate :#{method_name}, mode: 'strict', sha: '#{existing_sha}' do #{decoration_args}\n" +
66
+ commented_instructions +
67
+ indented_method_body +
66
68
  " end"
67
69
  end
68
70
 
71
+ def commented_method_source
72
+ DurableDecorator::Util.outdented_method_body unbound_method
73
+ end
74
+
75
+ def commented_instructions
76
+ " # call the old method with:\n" +
77
+ " # _#{existing_sha[0..3]}_#{method_name}\n" +
78
+ " \n" +
79
+ " # Alternatively, uncomment and override the method body below:\n" +
80
+ " \n"
81
+ end
82
+
83
+ def indented_method_body
84
+ commented_method_source.lines[1..-2].map do |line|
85
+ " ##{line}"
86
+ end.join
87
+ end
88
+
89
+ def unbound_method
90
+ DurableDecorator::Base.extract_method full_method_name
91
+ end
92
+
69
93
  def existing_sha
70
94
  DurableDecorator::Base.determine_sha full_method_name
71
95
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: durable_decorator_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Ivanov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-20 00:00:00.000000000 Z
11
+ date: 2014-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: durable_decorator