Module: Katello::LazyAccessor::InstanceMethods
- Defined in:
- app/lib/katello/lazy_accessor.rb
Instance Method Summary collapse
- #changed_remote_attributes ⇒ Object
- #changed_remote_attributes=(val) ⇒ Object
- #lazy_attributes ⇒ Object
- #reload ⇒ Object
- #remote_attribute_changed?(attr) ⇒ Boolean
- #save ⇒ Object
- #save! ⇒ Object
Instance Method Details
#changed_remote_attributes ⇒ Object
67 68 69 |
# File 'app/lib/katello/lazy_accessor.rb', line 67 def changed_remote_attributes @changed_remote_attributes ||= {} end |
#changed_remote_attributes=(val) ⇒ Object
71 72 73 |
# File 'app/lib/katello/lazy_accessor.rb', line 71 def changed_remote_attributes=(val) @changed_remote_attributes = val end |
#lazy_attributes ⇒ Object
98 99 100 101 102 |
# File 'app/lib/katello/lazy_accessor.rb', line 98 def lazy_attributes attrs = (self.class.superclass.respond_to? :lazy_attributes) ? self.class.superclass.lazy_attributes : [] attrs += (self.class.lazy_attributes || []) attrs.uniq end |
#reload ⇒ Object
92 93 94 95 96 |
# File 'app/lib/katello/lazy_accessor.rb', line 92 def reload(*) super.tap do changed_remote_attributes.clear end end |
#remote_attribute_changed?(attr) ⇒ Boolean
75 76 77 |
# File 'app/lib/katello/lazy_accessor.rb', line 75 def remote_attribute_changed?(attr) changed_remote_attributes.key?(attr) end |
#save ⇒ Object
79 80 81 82 83 84 |
# File 'app/lib/katello/lazy_accessor.rb', line 79 def save(*) if status = super changed_remote_attributes.clear end status end |
#save! ⇒ Object
86 87 88 89 90 |
# File 'app/lib/katello/lazy_accessor.rb', line 86 def save!(*) super.tap do changed_remote_attributes.clear end end |