deckorator 0.1.1 → 0.1.2

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: e3078b1fb68ab78418fe9f6b9c28f577a8a1c556
4
- data.tar.gz: d77f82ad5c2f69af043b55b8defdd6bc9dfaa1f8
3
+ metadata.gz: f6f276d78f7021570730acaa579b91dc36d1504e
4
+ data.tar.gz: 3cb3e00ae2d140b337582bfb9d1a0a9c21b95971
5
5
  SHA512:
6
- metadata.gz: 201b1aa1230f26921d2c3e250b6c234efea407af0ebe3cf8de6b688b31ae08e52a5b3de2f0ff6d4af930ce3b4308476063c89ccf0d3ec66241476b1dcc1614bb
7
- data.tar.gz: 092da84521948181ef688df8c6d05b7c84911cc066bc9311218240ca252b537bd0d041843f1de58131534053c0a1d3274a203b95c60d7d08a6e3db44f282c53e
6
+ metadata.gz: 53808134be2ef400c3307160877b5f5f6818aebef481443fbdb93212dbb2c25b48b68355ab274d7b3eb4e71916453b43f817fe381fa9c2f8761a616aeb0e2338
7
+ data.tar.gz: aceecc5972d941bb0e493df6171d783b294c8c07bbe48b703e0b85c578c5ff9ec0e8892191824241f433a86220b21365d1600cc09c8455ac573582a394f53b90
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015 John Otander, Jake Mays
3
+ Copyright (c) John Otander, Jake Mays
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,7 @@
1
1
  require 'deckorator/version'
2
2
  require 'deckorator/delegator'
3
3
  require 'deckorator/finder'
4
+ require 'deckorator/undecorator'
4
5
  require 'active_support/concern'
5
6
 
6
7
  module Deckorator
@@ -21,14 +22,18 @@ module Deckorator
21
22
  end
22
23
 
23
24
  included do
24
- helper_method :decorate if respond_to?(:helper_method)
25
- hide_action :decorate if respond_to?(:hide_action)
25
+ helper_method :decorate, :undecorate if respond_to?(:helper_method)
26
+ hide_action :decorate, :undecorate if respond_to?(:hide_action)
26
27
  end
27
28
 
28
29
  def decorate(record)
29
30
  Deckorator.decorate(record)
30
31
  end
31
32
 
33
+ def undecorate(decorated_record)
34
+ decorated_record.try(:decorated_object)
35
+ end
36
+
32
37
  private
33
38
 
34
39
  def self.decorate_object(record)
@@ -0,0 +1,11 @@
1
+ require 'active_support/concern'
2
+
3
+ module Deckorator
4
+ module Undecorator
5
+ extend ActiveSupport::Concern
6
+
7
+ def undecorate
8
+ decorated_object
9
+ end
10
+ end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module Deckorator
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
@@ -1,5 +1,6 @@
1
1
  class ApplicationDecorator
2
2
  include Deckorator::Delegator
3
+ include Deckorator::Undecorator
3
4
 
4
5
  attr_accessor :decorated_object
5
6
  cattr_accessor :decorated_object_class
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deckorator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Otander
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-02-03 00:00:00.000000000 Z
12
+ date: 2016-02-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -103,6 +103,7 @@ files:
103
103
  - lib/deckorator.rb
104
104
  - lib/deckorator/delegator.rb
105
105
  - lib/deckorator/finder.rb
106
+ - lib/deckorator/undecorator.rb
106
107
  - lib/deckorator/version.rb
107
108
  - lib/generators/deckorator/decorator/USAGE
108
109
  - lib/generators/deckorator/decorator/decorator_generator.rb
@@ -131,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
132
  version: '0'
132
133
  requirements: []
133
134
  rubyforge_project:
134
- rubygems_version: 2.4.5.1
135
+ rubygems_version: 2.5.1
135
136
  signing_key:
136
137
  specification_version: 4
137
138
  summary: Lightweight decorators using plain old Ruby objects.