intercept 0.2.2 → 0.2.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
  SHA256:
3
- metadata.gz: 0d2f2814a4f63bdb2c0ee135547bd804aa32cb8cf7770850eb2f37d8af3a7dbe
4
- data.tar.gz: e89c860c4bd74276d40e7424a3ea103d8a6577a2174c3180a63a3fa724ca131e
3
+ metadata.gz: ca86bc01920dbdf85af943a201225d6d316efe711639a5e1e3f3058cba2b1685
4
+ data.tar.gz: 58671f0ffd90c86202091627edd3e89336d1733877f27891360ce12b41e6d9d8
5
5
  SHA512:
6
- metadata.gz: 537ecdbab92598bd4fe189228f87d9c5292dcf2e9b109ae7d565df8163e0333e7cf20c12e922601558694b06032688da17f8c46cd1cca2743479e298c375424f
7
- data.tar.gz: c9ac638c4391ced33252dda5e65329aeb8e337b08fb1f052c6431dc307ef0c8e05209479f0dafbb5564c643f89b539504b475ecbbe4ae32d28405fb45734dafa
6
+ metadata.gz: 36418ca96ec020040d43a46f240513b13e2569601764d097f9e30ffa2b4dcac4f83f8cbe5e032d29f3c10dc940628c9ee5e63b92ac9d4115df1f1787d391a79d
7
+ data.tar.gz: 40e1d6d483720e14b149ae531cfcf808a075823f4671bf8e095cd9168df642ce6daabb11434dfb86101d922bbc38f3637a78858d352dce4021c756d172061e2d
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- intercept (0.2.1)
4
+ intercept (0.2.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -32,4 +32,4 @@ DEPENDENCIES
32
32
  rspec (~> 3.0)
33
33
 
34
34
  BUNDLED WITH
35
- 1.16.2
35
+ 1.17.1
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Intercept
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/intercept`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ [![Gem Version](https://badge.fury.io/rb/intercept.svg)](https://badge.fury.io/rb/intercept) [![Maintainability](https://api.codeclimate.com/v1/badges/89e9e742466987d05bf4/maintainability)](https://codeclimate.com/github/GeminPatel/intercept/maintainability)
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ Intercept and modify ruby objects with publisher-subscriber pattern
6
6
 
7
7
  ## Installation
8
8
 
@@ -4,7 +4,7 @@ module Intercept
4
4
  attr_reader :suffix
5
5
 
6
6
  def initialize(suffix)
7
- @suffix = suffix
7
+ @suffix = parse_suffix suffix
8
8
  end
9
9
 
10
10
  def decorate(value)
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Intercept
4
+ module Decorator
5
+ class Replace
6
+ attr_reader :replace_value
7
+
8
+ def initialize(replace_value)
9
+ @replace_value = parse_replace_value replace_value
10
+ end
11
+
12
+ def decorate(_)
13
+ replace_value.call
14
+ end
15
+
16
+ private
17
+
18
+ def parse_replace_value(replace_value)
19
+ if replace_value.respond_to?(:call)
20
+ replace_value
21
+ else
22
+ raise '@param replace_value must respond to #call'
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -6,7 +6,7 @@ module Intercept
6
6
  attr_reader :replace_value
7
7
 
8
8
  def initialize(replace_value)
9
- @replace_value = replace_value
9
+ @replace_value = parse_replace_value replace_value
10
10
  end
11
11
 
12
12
  def process(value)
@@ -1,3 +1,3 @@
1
1
  module Intercept
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.5'
3
3
  end
@@ -6,6 +6,7 @@ require 'intercept/strategy/mapper'
6
6
  require 'intercept/strategy/white_list'
7
7
  require 'intercept/decorator_builder'
8
8
  require 'intercept/decorator/add_suffix'
9
+ require 'intercept/decorator/replace'
9
10
 
10
11
  module Intercept
11
12
  # Base class of the intercept module.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: intercept
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gemin Patel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-10 00:00:00.000000000 Z
11
+ date: 2018-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -73,6 +73,7 @@ files:
73
73
  - intercept.gemspec
74
74
  - lib/intercept.rb
75
75
  - lib/intercept/decorator/add_suffix.rb
76
+ - lib/intercept/decorator/replace.rb
76
77
  - lib/intercept/decorator_builder.rb
77
78
  - lib/intercept/strategy/mapper.rb
78
79
  - lib/intercept/strategy/replace.rb