module Cobbler::Common::Finders::ClassMethods

Public Instance Methods

find() { |c_record| ... } click to toggle source
# File lib/cobbler/common/finders.rb, line 36
def find(&block)
    raise "No idea how to fetch a list of myself, as no find_all method is defined" unless api_methods[:find_all]
    result = []
    in_transaction { make_call(api_methods[:find_all]) }.to_a.each do |record|
        c_record = new(record,false)
        result << c_record
        yield(c_record) if block_given?
    end
    return result
end
find_one(name) click to toggle source
# File lib/cobbler/common/finders.rb, line 47
def find_one(name)
    raise "No idea how to fetch myself, as no find_one method is defined" unless api_methods[:find_one]
    properties = in_transaction { make_call(api_methods[:find_one],name) }
    valid_properties?(properties) ? new(properties,false) : nil
end