super_callbacks 1.1.1 → 1.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: d85eea1a2d90bbdb5cfc24ecb5802028d8e2731e
4
- data.tar.gz: 7bf85904a4f840b5460508709209b58f0fbc4091
3
+ metadata.gz: 3fd64d5b5a8b0fb21cbafcc317f899179a7963e8
4
+ data.tar.gz: 7e4297e1e6fcaf6d3ee7bf9f0a4ca496e441968e
5
5
  SHA512:
6
- metadata.gz: db5229ca3057ff385a18c19a4bb11563f6e8011946d34a75091d18ed10e8419f522d80acd29c4a304e2c39c2048ac94aa669e897984e6efe238999aea5d9621b
7
- data.tar.gz: 56af056bf3be8527d33154e1b9eaea89ab82a3b5d941fd52bd1a9c63dd630fd2ab7bbb3af023ec9d0074a0230f73abec66111a0da31226b60df2344c61e54447
6
+ metadata.gz: e2e56689fd4acb40b21350965389c379a6a8dd6315b0012f148807853dc6500d1f5e9533538ba0870ae054969c9e51b54c4d06056bdcc7fe069e488f67008feb
7
+ data.tar.gz: db281bec9a46bf31edb20e4d11b833daa1871c061242f9161bea66fd5f085bfb6b1c8e1ceab7228f5011f18f82932757ad1493c4ae64474eeadc53d19b833f05
data/README.md CHANGED
@@ -370,7 +370,7 @@ end
370
370
  class Foo
371
371
  include SuperCallbacks
372
372
 
373
- attr_accessor :bar, :baz
373
+ attr_accessor :bar
374
374
 
375
375
  after :bar= do |arg|
376
376
  puts 'original values of all instance attributes:'
@@ -401,7 +401,7 @@ foo.bar = 1 # bar is not changed from 1 to 1
401
401
  # => 1
402
402
  ```
403
403
 
404
- *Notice above on the second time `foo.bar = 1` is called, "new value" was no longer "puts", because `@bar` didn't change from 1 to 1. You can only use `instance_variables_before_change`, instance_variable_before_change` and `instance_variable_changed?` inside the SuperCallback cycle; otherwise you will get a `"You cannot call this method outside the SuperCallback cycle"` error.
404
+ *Notice above on the second time `foo.bar = 1` is called, "new value" was no longer "puts", because `@bar` didn't change from 1 to 1. You can only use `instance_variables_before_change`, `instance_variable_before_change` and `instance_variable_changed?` inside the SuperCallback cycle; otherwise you will get a `"You cannot call this method outside the SuperCallback cycle"` error.*
405
405
 
406
406
  *Above uses `after!`, but works similarly with `before!`*
407
407
 
@@ -425,7 +425,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
425
425
 
426
426
  ## Changelog
427
427
 
428
- * 1.1.1 (2019-08-14)
428
+ * 1.1.2 (2019-08-14)
429
429
  * [Supported "dirty" checking of instance variable changes](#example-10-dirty-checking-of-instance-variables-changes)
430
430
  * 1.0.3 (2019-08-12)
431
431
  * Cleaner code without explicitly calling `run_callbacks` anymore; done now because of ruby upgrade from 1.9 to 2.0+ which already supports `prepend`
@@ -139,14 +139,14 @@ module SuperCallbacks
139
139
  def instance_variable_before_change(instance_variable)
140
140
  raise ArgumentError, "#{instance_variable} should be a string that starts with `@`" unless instance_variable.to_s.start_with? '@'
141
141
  raise 'You cannot call this method outside the SuperCallback cycle' if instance_variables_before_change.nil?
142
- instance_variables_before_change[instance_variable]
142
+ instance_variables_before_change[instance_variable.to_sym]
143
143
  end
144
144
 
145
145
  def instance_variable_changed?(instance_variable)
146
146
  raise ArgumentError, "#{instance_variable} should be a string that starts with `@`" unless instance_variable.to_s.start_with? '@'
147
147
  raise 'You cannot call this method outside the SuperCallback cycle' if instance_variables_before_change.nil?
148
148
 
149
- before_change_value = instance_variable_before_change(instance_variable)
149
+ before_change_value = instance_variable_before_change(instance_variable.to_sym)
150
150
  current_value = instance_variable_get(instance_variable)
151
151
  before_change_value != current_value
152
152
  end
@@ -1,3 +1,3 @@
1
1
  module SuperCallbacks
2
- VERSION = '1.1.1'
2
+ VERSION = '1.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: super_callbacks
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jules Roman B. Polidario