def resources(type = nil)
            if type.nil?
                self.extgstates
                    .merge self.colorspaces
                    .merge self.patterns
                    .merge self.shadings
                    .merge self.xobjects
                    .merge self.fonts
                    .merge self.properties
            else
                self.each_resource(type).to_h
            end
        end
def resources(type = nil)
            if type.nil?
                self.extgstates
                    .merge self.colorspaces
                    .merge self.patterns
                    .merge self.shadings
                    .merge self.xobjects
                    .merge self.fonts
                    .merge self.properties
            else
                self.each_resource(type).to_h
            end
        end
Returns a Hash of all resources in the object or only the specified _type_.