Module: Katello::LazyAccessor::InstanceMethods

Defined in:
app/lib/katello/lazy_accessor.rb

Instance Method Summary collapse

Instance Method Details

#changed_remote_attributesObject



51
52
53
# File 'app/lib/katello/lazy_accessor.rb', line 51

def changed_remote_attributes
  @changed_remote_attributes ||= {}
end

#changed_remote_attributes=(val) ⇒ Object



55
56
57
# File 'app/lib/katello/lazy_accessor.rb', line 55

def changed_remote_attributes=(val)
  @changed_remote_attributes = val
end

#lazy_attributesObject



78
79
80
81
82
# File 'app/lib/katello/lazy_accessor.rb', line 78

def lazy_attributes
  attrs = (self.class.superclass.respond_to? :lazy_attributes) ? self.class.superclass.lazy_attributes : []
  attrs += (self.class.lazy_attributes || [])
  attrs.uniq
end

#reloadObject



72
73
74
75
76
# File 'app/lib/katello/lazy_accessor.rb', line 72

def reload(*)
  super.tap do
    changed_remote_attributes.clear
  end
end

#saveObject



59
60
61
62
63
64
# File 'app/lib/katello/lazy_accessor.rb', line 59

def save(*)
  if (status = super)
    changed_remote_attributes.clear
  end
  status
end

#save!Object



66
67
68
69
70
# File 'app/lib/katello/lazy_accessor.rb', line 66

def save!(*)
  super.tap do
    changed_remote_attributes.clear
  end
end