mini_decorator 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mini_decorator.rb +7 -1
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7672cb4e22e5db7b4c32e784d617b0c7a5e67e4b532558455245098016f26c48
4
- data.tar.gz: d192372df2c78cc36d316012d45341d07c2c43a5055a83f046fd17d024c0852a
3
+ metadata.gz: ac5735d15bbc24bdbf32eb7d6a3ba930d9b53bc4cd771b6fddf1d8ca9155efd4
4
+ data.tar.gz: 5ef7219e24e4bc480d48e159098f4549cb86fce28a34be799e55c96e8cae0944
5
5
  SHA512:
6
- metadata.gz: 8041092be9c829b06ebce8f851e9b73ecd9b70f64069ff77691ac684ae19edb50b4801cc04e5fa836b73fe55d20359289a1cc344f338e4892e961038f586afb9
7
- data.tar.gz: 936fc0ee2527aca51d6b9bbb702d02b7abf6752e0d114f12886794fa08b78357f2dddd6ae8411f1e6e8dcc212ab6232d70402ad8d0a6cca2b80c63db2b36a192
6
+ metadata.gz: 8836f2fb081b413536815702ad8b459f1e4fd7c102d8f97110133e24db7b628e50edd53d76d0b0b6a0f98305643acfbb3d9b6832699c2f8e86a2ad278e2886bd
7
+ data.tar.gz: c0fa7a669859b304b7873c4a44862bab78e1483560bc3a5724fde36ec4c2d7abd071fba9f8648f0ea9f4076a11b6b8439be1d922516e8340df9473fd5715a1b1
@@ -1,7 +1,13 @@
1
1
  class MiniDecorator < Module
2
2
  def initialize(decorator)
3
3
  define_method(:decorate) do |property|
4
- decorator.public_send(property, self)
4
+ if decorator.respond_to? property
5
+ decorator.public_send(property, self)
6
+ elsif self.respond_to? property
7
+ self.public_send(property)
8
+ else
9
+ raise NoMethodError.new "No decorator or object method found for property: #{property}"
10
+ end
5
11
  end
6
12
  end
7
13
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_decorator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan McCallum
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-24 00:00:00.000000000 Z
11
+ date: 2020-06-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
- email: hello@nathan-mccallum.com
14
+ email: hey@nathan-mccallum.com
15
15
  executables: []
16
16
  extensions: []
17
17
  extra_rdoc_files: []