# File lib/ironfan/provider.rb, line 97 def self.aggregate!(*p) Ironfan.noop(self,__method__,*p); end
Manipulation
# File lib/ironfan/provider.rb, line 94 def self.create!(*p) Ironfan.noop(self,__method__,*p); end
# File lib/ironfan/provider.rb, line 98 def self.destroy!(*p) Ironfan.noop(self,__method__,*p); end
# File lib/ironfan/provider.rb, line 134 def self.forget(id) self.known.delete(id) end
# File lib/ironfan/provider.rb, line 130 def self.forget! @@known[self.name] = { } end
# File lib/ironfan/provider.rb, line 67 def self.handle ; name.to_s.gsub(/.*::/,'').to_sym ; end
Provide a separate namespace in @@known for each subclass
# File lib/ironfan/provider.rb, line 139 def self.known @@known[self.name] ||= {} end
Discovery
# File lib/ironfan/provider.rb, line 85 def self.load!(*p) Ironfan.noop(self,__method__,*p); end
Can multiple instances of this resource be associated with the computer?
# File lib/ironfan/provider.rb, line 80 def self.multiple?() false; end
# File lib/ironfan/provider.rb, line 143 def self.patiently(name, error_class, options={}) options[:message] ||= 'ignoring %s' options[:wait_time] ||= 1 options[:max_tries] ||= 10 success = false tries = 0 until success or (tries > options[:max_tries]) do begin result = yield success = true # If we made it to this line, the yield didn't raise an exception rescue error_class => e tries += 1 if options[:ignore] and options[:ignore].call(e) success = true Ironfan.substep(name, options[:message] % e.message, options[:display] ? :red : :gray) else Ironfan.substep(name, options[:message] % e.message, options[:display] ? :red : :gray) Ironfan.substep(name, "sleeping #{options[:sleep_time]} second(s) before trying again") sleep options[:wait_time] result = e end end end
# File lib/ironfan/provider.rb, line 96 def self.prepare!(*p) Ironfan.noop(self,__method__,*p); end
# File lib/ironfan/provider.rb, line 125 def self.recall(id=nil) return self.known if id.nil? self.known[id] end
# File lib/ironfan/provider.rb, line 121 def self.recall?(id) self.known.include? id end
# File lib/ironfan/provider.rb, line 69 def self.receive(obj) obj = obj.symbolize_keys if obj.is_a?(Hash) super(obj) end
Register and return the (adapted) object with the collection
# File lib/ironfan/provider.rb, line 115 def self.register(native) result = new(:adaptee => native) or return remember result result end
# File lib/ironfan/provider.rb, line 108 def self.remember(resource,options={}) index = options[:id] || resource.name index += options[:append_id] if options[:append_id] self.known[index] = resource end
# File lib/ironfan/provider.rb, line 95 def self.save!(*p) Ironfan.noop(self,__method__,*p); end
Generated with the Darkfish Rdoc Generator 2.