smooth_operator 1.2.8 → 1.2.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- N2UwNzVjODExYjU5ZDViZjZhNmQwYmNlMGU5NjkxOGQ5N2U3YWFhYw==
4
+ NzlkNzFkMjI1Y2UyZTRlNzYwNWIxYWJmMTIwYjMxM2RmNzYxZWQ2Yg==
5
5
  data.tar.gz: !binary |-
6
- ZjgwNjE3MGYzMTQ5NWVkYzkzZjU1MWRjMmJmNjFjYjkwMmYxN2JiNw==
6
+ Njc2YzU4YTRjOTFiY2QxMmE1YjA3NDRkMWYxNzZmYWM5YzBlMzAxYQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZThlZTRkMTMzMDcyMmE1MzU3ZDJkYzkxMzE2ZDU1NDUxZDc0NzFiN2M2ZmI3
10
- ZDRjYjk0MWU1OGFhMWQ0MzllZWRlODM2YTczYTYyZGJmYzU3MmZkZTM1MWEx
11
- ZGM5ZTAxNGJhOWVlM2QyMzM1NTI4N2Q0MjBkOThhYjA0MGM2NjY=
9
+ NmE0OGIxNDc4YTgxNDFmNjBhZDE3YzNjMzdhYmYzOWRmMzA4ZTU4NjgyZjQ1
10
+ YmI3YmZhYzE3YzVkODliYzhkNzc5YjU1MzViMzBjZGIwN2IzZThmMjI4ZmZl
11
+ ODNhYzI1MjY0NTY1ZTZhMTU2NjNlOTE1ZWU4MWRkYzY2ZWFmMTM=
12
12
  data.tar.gz: !binary |-
13
- ZGJhZmMwZWJmOTVlMGIzMzgzMmE4NTAyN2Y4MzYyZTk4NmY4YjA0ZDQ3OTRj
14
- OGY0NDZjYmJjNDE1ZGNhYzhhMGJjMmVkZDk4Nzc0MTUwMGEyNTVlZjhkODIz
15
- OWQyN2U4NmExOGYxYjJjNGM0NWExZDI1ODFlMDA2YTEyOTIxNDg=
13
+ ZDQxZDg3ZjhiMGJjNWE3ZjJhOTQyMjE2NzM1OGI5YWMwOTQ0M2QzN2VhMGFi
14
+ YjcxMGZiZDg4ZDcyMTU3NzcyMTYyZTRkYTU2MThjNmRlYThlN2EzYzRmZjI4
15
+ ZDAyM2M2ZjU1MjVmYWFhZWI4NWU0YmVhMDBhMTU5ZGU1MzZkMTI=
@@ -46,7 +46,7 @@ module SmoothOperator
46
46
  def new_record_or_mark_for_destruction?(attribute_name, attribute_value)
47
47
  return nil unless self.class.respond_to?(:smooth_operator?)
48
48
 
49
- mark_for_destruction?(attribute_value) if attribute_name == self.class.destroy_key
49
+ marked_for_destruction?(attribute_value) if attribute_name == self.class.destroy_key
50
50
 
51
51
  new_record?(true) if attribute_name == self.class.primary_key
52
52
  end
@@ -0,0 +1,7 @@
1
+ # THANKS tdantas! https://github.com/tdantas
2
+
3
+ module SmoothOperator
4
+ class BlankSlate
5
+ instance_methods.each { |m| undef_method m unless m =~ /^__|object_id/ }
6
+ end
7
+ end
@@ -26,8 +26,20 @@ module SmoothOperator
26
26
  new_array_entry
27
27
  end
28
28
 
29
+ undef :is_a?
30
+
29
31
  protected ############### PROTECTED ###############
30
32
 
33
+ # def method_missing(method, *args, &block)
34
+ # if get_array.respond_to?(method)
35
+ # puts "if true #{method} - #{args}"
36
+ # get_array.send(method, *args)
37
+ # else
38
+ # puts "if else #{method}"
39
+ # super
40
+ # end
41
+ # end
42
+
31
43
  def get_array
32
44
  data = object.get_internal_data(association.to_s)
33
45
 
@@ -72,7 +72,13 @@ module SmoothOperator
72
72
  def define_single_association_method(reflection, association)
73
73
  define_method(association) { get_internal_data(association.to_s) }
74
74
 
75
- define_method("build_#{reflection.single_name}") { |attributes = {}| reflection.klass.new(attributes) }
75
+ define_method("build_#{association}") do |attributes = {}|
76
+ new_instance = reflection.klass.new(attributes)
77
+
78
+ push_to_internal_data(association, new_instance)
79
+
80
+ new_instance
81
+ end
76
82
  end
77
83
 
78
84
  def define_attributes_setter_methods(reflection, association)
@@ -1,3 +1,3 @@
1
1
  module SmoothOperator
2
- VERSION = "1.2.8"
2
+ VERSION = "1.2.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smooth_operator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.8
4
+ version: 1.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - João Gonçalves
@@ -87,6 +87,7 @@ files:
87
87
  - lib/smooth_operator/attributes/base.rb
88
88
  - lib/smooth_operator/attributes/dirty.rb
89
89
  - lib/smooth_operator/attributes/normal.rb
90
+ - lib/smooth_operator/blank_slate.rb
90
91
  - lib/smooth_operator/delegation.rb
91
92
  - lib/smooth_operator/finder_methods.rb
92
93
  - lib/smooth_operator/helpers.rb