lite-decorator 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 79964d52a1fbc21e1b05b9fa7b7ba819a49e0dcfa1ad82999fa4ac5c3361cfd3
4
- data.tar.gz: 2320e385b9dae23e2b3834a6fc47990780c74eca64db25a59859c1c61eb9ca29
3
+ metadata.gz: 86273c0729ff8bedae37cb2b0c05a502e368fab6aba0a9e32c639acddb9335ab
4
+ data.tar.gz: c06a5e0ee30f5f8f84a76ac39a6cb028ce4955cbb86d51e14671b608a0deb9c7
5
5
  SHA512:
6
- metadata.gz: c2c3b1b9994591964fcf233883e635ab7ce649c3ce8e2dac46cd8e37d5010d27818117ee9a38ec038bef76a40975566f0cf085420675b295c66919cad178dcd0
7
- data.tar.gz: 6ff5619a096ea3ea9333713fb4ba59936c407670ab71ad9856b177ddda2dbf766caaa82b91b0a5c022d5b3b3e1acc5c2d5fd43f02fcc564d47372ec7d31872c9
6
+ metadata.gz: a049d6bd1d9a19fa4c34e233525e4bd40cb621470c4a52ff1758d886c3c3ac5e8b004e5e9abfdb231e6655074fdb7b406f3465e04ea7dd0fcde6c04388074b5a
7
+ data.tar.gz: 1243a68c3306d38f3c828fa75ec1fea227597934b9e80238ba7cab476e8d98dc843b08efa709d22a8753a7bf8864a923a786a23b1d7554d1bd10721560e0eccf
data/CHANGELOG.md CHANGED
@@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [2.0.1] - 2024-09-23
10
+ ### Changed
11
+ - Rename `Infered` to `Inference` and `Record` to `Delegator`
12
+
13
+ ## [2.0.0] - 2024-09-22
14
+ ### Changed
15
+ - Split inference from lazy delegation
16
+
9
17
  ## [1.3.1] - 2024-09-20
10
18
  ### Changed
11
19
  - Memoize record decorator class
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lite-decorator (2.0.0)
4
+ lite-decorator (2.0.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -26,7 +26,6 @@ Or install it yourself as:
26
26
 
27
27
  * [Setup](#setup)
28
28
  * [Usage](#usage)
29
- * [ActiveRecord](#active_record)
30
29
 
31
30
  ## Setup
32
31
 
@@ -75,33 +74,31 @@ collection = UserDecorator.new(users)
75
74
  collection.map(&:full_name) #=> ["John Doe", "Jane Poe"]
76
75
  ```
77
76
 
78
- ## Infered decoration
77
+ #### Infered decoration
79
78
 
80
- Including the `Infered` module will setup a `decorator_class` and `decorator` method
79
+ Including the `Inference` module will setup a `decorator_class` and `decorator` method
81
80
  that you can access via your PORO and ActiveRecord objects.
82
81
 
83
82
  ```ruby
84
- class User < ActiveRecord::Base
85
- include Lite::Decorator::Infered
83
+ class User
84
+ include Lite::Decorator::Inference
86
85
  end
87
86
 
88
- # Usage
89
87
  user = User.first
90
88
  user.decorator.full_name
91
89
  ```
92
90
 
93
- ## Record decoration
91
+ #### Decorator delegation
94
92
 
95
- Including the `Record` module will use method missing to delegate decorator methods as
96
- if it lived on the ActiveRecord object itself. If neither the class instance and the
93
+ Including the `Delegator` module will use method missing to delegate decorator methods as
94
+ if it lived on the PORO or ActiveRecord object itself. If neither the class instance and the
97
95
  decorator contain the method, a `NoMethodError` just like normal.
98
96
 
99
97
  ```ruby
100
98
  class User < ActiveRecord::Base
101
- include Lite::Decorator::Record
99
+ include Lite::Decorator::Delegator
102
100
  end
103
101
 
104
- # Usage
105
102
  user = User.first
106
103
  user.full_name
107
104
  ```
@@ -2,10 +2,10 @@
2
2
 
3
3
  module Lite
4
4
  module Decorator
5
- module Record
5
+ module Delegator
6
6
 
7
7
  def self.included(base)
8
- base.include Infered
8
+ base.include Inference
9
9
  end
10
10
 
11
11
  private
@@ -25,7 +25,7 @@ module Lite
25
25
  def respond_to_method?(method_name)
26
26
  return respond_to_method_cache[method_name] if respond_to_method_cache.key?(method_name)
27
27
 
28
- respond_to_method_cache[method_name] = decorator.present? && decorator.public_methods.include?(method_name)
28
+ respond_to_method_cache[method_name] = decorator&.public_methods&.include?(method_name)
29
29
  end
30
30
 
31
31
  def respond_to_missing?(method_name, include_private = false)
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Lite
4
4
  module Decorator
5
- module Infered
5
+ module Inference
6
6
 
7
7
  def decorator_class
8
8
  return @decorator_class if defined?(@decorator_class)
@@ -3,7 +3,7 @@
3
3
  module Lite
4
4
  module Decorator
5
5
 
6
- VERSION = "2.0.0"
6
+ VERSION = "2.0.1"
7
7
 
8
8
  end
9
9
  end
@@ -4,5 +4,5 @@ require "generators/rails/decorator_generator" if defined?(Rails::Generators)
4
4
 
5
5
  require "lite/decorator/version"
6
6
  require "lite/decorator/base"
7
- require "lite/decorator/infered"
8
- require "lite/decorator/record"
7
+ require "lite/decorator/inference"
8
+ require "lite/decorator/delegator"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lite-decorator
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez
@@ -204,8 +204,8 @@ files:
204
204
  - lib/generators/rails/templates/decorator.rb.tt
205
205
  - lib/lite/decorator.rb
206
206
  - lib/lite/decorator/base.rb
207
- - lib/lite/decorator/infered.rb
208
- - lib/lite/decorator/record.rb
207
+ - lib/lite/decorator/delegator.rb
208
+ - lib/lite/decorator/inference.rb
209
209
  - lib/lite/decorator/version.rb
210
210
  - lite-decorator.gemspec
211
211
  homepage: http://drexed.github.io/lite-decorator