
676 A.2d 1343 (1996)
ST. JAMES CONDOMINIUM ASSOCIATION et al.
v.
Ken LOKEY et al.
No. 94-321-Appeal.
Supreme Court of Rhode Island.
May 30, 1996.
*1344 Patrick J. Quinlan, Kathleen A. Birt, Providence, for Plaintiff.
Joseph C. Salvadore, Providence, for Defendant.
Ken Lokey, Pro Se.
OPINION
LEDERBERG, Justice.
This case came before the Supreme Court on the appeal of St. James Condominium Association and Joseph Whalen, individually and on behalf of other condominium unit owners (plaintiffs), from a final judgment of dismissal in the Superior Court of the plaintiffs' complaint against the defendants, Madeline Ferrante, treasurer of the town of North Providence (town), and Al DePetrillo, building inspector of the town of North Providence (building inspector). For the reasons set forth, we sustain the appeal of the plaintiffs and reverse the judgment of the Superior Court. A brief recitation of the facts relevant to this appeal follows. Additional facts will be provided as necessary to the discussion of the issues.
Facts and Travel of the Case
On March 22, 1993, plaintiffs, as owners of condominium units in the St. James Condominium development (St. James) in North Providence, Rhode Island, brought suit in Superior Court against the developer of the project, as well as against its architect and the warranty company, seeking damages for allegedly defective construction and workmanship in the building of their units. The plaintiffs alleged that negligent plans and construction of the St. James units that they purchased during the years 1987 to 1993 resulted in major defects, including settling foundations, cracked walls, frozen pipes, leaking roofs, and improper heating. In addition, plaintiffs alleged that "proper regulation firewalls were not constructed between the units."
The plaintiffs also brought suit against the town and the building inspector, alleging that the building inspector had negligently inspected or failed to inspect the plans and construction of the project and had negligently issued occupancy permits for units within the development. The complaint stated that "proper investigation by the building inspector at the time of construction, would have revealed building code violations," and charged that the town was "negligent for the actions of its public officials [referring to the *1345 building inspector] under the doctrine of Respondeat Superior."
On or about September 8, 1993, plaintiffs served interrogatories on the building inspector. After the Superior Court granted plaintiffs' motion to compel answers to the interrogatories, the building inspector filed his answers on February 16, 1994. The town and the building inspector filed a motion to dismiss plaintiffs' claims on February 17, 1994, invoking immunity from liability under the public-duty doctrine. In opposing defendants' motion, plaintiffs submitted to the trial justice two documents: an inspection form for one of the buildings in question that states, "Need smoke stops between units. Stairs need re-building no overhang Boiler rooms" and an occupancy permit for the same building. The Superior Court granted the motion to dismiss on April 26, 1994, and final judgment was entered for the town and the building inspector on May 9, 1994. The plaintiffs filed a timely notice of appeal on May 9, 1994, and the case was placed on the regular calendar for full briefing and argument.
Dismissal of the Complaint
On appeal, plaintiffs claimed that this case fell within the special-duty exception to the public-duty doctrine and argued that they had not been provided a sufficient opportunity to present the full facts that supported their claim. The plaintiffs contended that at the time the trial justice granted defendants' motion to dismiss, plaintiffs had "only just begun discovery, and the dismissal was an abuse of discretion." The town and the building inspector argued, on the other hand, that plaintiffs were afforded sufficient opportunity to offer facts adequate to support their claims but that plaintiffs had failed to do so.
Before determining whether the trial justice erred in granting defendants' motion, we must first ascertain the nature of the motion itself.[1] The trial justice's order granting the motion correctly referred to defendants' motion as a Super. R. Civ. P. 12(b)(6) motion to dismiss plaintiffs' claims for failure to state a claim upon which relief can be granted. Nevertheless, defendants contended that "[b]y using matters outside the pleadings, Plaintiffs invited the Court to treatment [sic] the Defendants' Motion as a motion for summary judgment." With this contention, we must disagree.
This Court has recognized that "when a trial justice considers evidence not incorporated in the final pleadings, a motion to dismiss under Rule 12(b)(6) is automatically transformed into one for summary judgment pursuant to Rule 56." Tangleridge Development Corp. v. Joslin, 570 A.2d 1109, 1111 (R.I.1990) (citing Temple Sinai-Suburban Reform Temple v. Richmond, 112 R.I. 234, 239, 308 A.2d 508, 511 (1973)). In such a case, however, the clear mandate of Rule 12(b)(6) requires that whenever a motion to dismiss is treated as a motion for summary judgment, "all parties shall be given reasonable opportunity to present all material made pertinent to such motion by Rule 56."
Although plaintiffs did submit for the trial justice's consideration two documents extrinsic to the pleadings, our review of the record, particularly our review of the trial justice's order granting defendants' motion, leads us to conclude that the trial justice decided the motion as a Rule 12(b)(6) motion to dismiss, rather than as a motion for summary judgment under Rule 56. We reach this conclusion because the motion justice made no reference to the matters outside the pleadings when she ruled on the motion. The trial justice's order was entitled, "Order Granting Defendants, Madeline Ferrante, Treasurer of the Town of North Providence and Albert DePetrillo, Building Inspector for the Town of North Providence's Motion to Dismiss Plaintiff's Action Pursuant to R.C.P. 12(b)(6)." The defendants had drafted the order but argued on appeal that the order in fact granted summary judgment. The plaintiffs, however, were not notified, as required by Rule 12(b)(6), that defendants' motion to *1346 dismiss was being converted into a motion for summary judgment.
We are of the opinion that the better practice when ruling on a motion to dismiss using a Rule 12(b)(6) standard is for the trial court to state expressly in its decision on the motion whether it has excluded any extraneous matters from its consideration. Under such a procedure, the parties as well as this Court upon review can ascertain with confidence whether the trial court has excluded matters outside the pleadings from its consideration. Nevertheless, we review the judgment in the case at bar as a judgment to dismiss and not as a summary judgment.
In reviewing a trial justice's grant of a motion to dismiss pursuant to Rule 12(b)(6), this Court assumes the allegations contained in the complaint to be true and views the facts in the light most favorable to the plaintiffs. Builders Specialty Co. v. Goulet, 639 A.2d 59, 60 (R.I.1994); Ellis v. Rhode Island Public Transit Authority, 586 A.2d 1055, 1057 (R.I.1991). This Court has cautioned that such a motion should not be granted "unless it appears to a certainty that [the plaintiffs] will not be entitled to relief under any set of facts which might be proved in support of [their] claim." Bragg v. Warwick Shoppers World, Inc., 102 R.I. 8, 12, 227 A.2d 582, 584 (1967). Dismissal pursuant to Rule 12(b)(6) is particularly disfavored where, as here, defendants assert immunity under the public-duty doctrine. Haley v. Town of Lincoln, 611 A.2d 845, 849-50 (R.I. 1992).
Public-Duty Doctrine
The public-duty doctrine protects the state and its political subdivisions from tort liability arising out of the performance of governmental functions not commonly undertaken by private entities. Id. at 849; Bierman v. Shookster, 590 A.2d 402, 403 (R.I. 1991). This Court has long recognized, however, that the immunity does not extend to cases in which a plaintiff can show that a special duty was owed by the defendant to the plaintiff individually, and not to the public in general. Haley, 611 A.2d at 849; Ryan v. State Department of Transportation, 420 A.2d 841, 843 (R.I.1980).
The plaintiffs can establish the existence of a special duty by demonstrating that they "have had some form of prior contact with state or municipal officials `who then knowingly embarked on a course of conduct that endangered the plaintiffs, or they have otherwise specifically come within the knowledge of the officials so that the injury to that particularly identified plaintiff can be or should have been foreseen.'" Quality Court Condominium Association v. Quality Hill Development Corp., 641 A.2d 746, 750 (R.I.1994) (quoting Knudsen v. Hall, 490 A.2d 976, 978 (R.I.1985)). In light of our previous statement that it is "virtually impossible" for a defendant invoking immunity under the public-duty doctrine to sustain its burden in a motion to dismiss, we are of the opinion that the trial justice erred in granting defendants' motion. Haley, 611 A.2d at 849.[2]
The record before us reveals ambiguity sufficient to create a reasonable doubt that plaintiffs would be unable to establish that defendants owed them a special duty. In holding that judgment on the pleadings was inappropriate in Haley, we concluded:
"The factual allegations contained in the pleadings, viewed in the manner most favorable to the nonmovant plaintiffs, were too incomplete for the court to have found that plaintiffs would be unable to prove at trial facts that constitute a valid claim for relief. It could not be said beyond a doubt that defendants * * * under any set of facts that might be proven in support of the complaint, do not owe plaintiffs a special duty of care." 611 A.2d at 850.
It is possible to conceive of factual scenarios that, if proven by a plaintiff at trial, could establish the existence of a special duty owed by a defendant to that plaintiff. In their complaint, for example, the plaintiffs here alleged that the building inspector had "failed to examine plans and specifications or negligently examined the plans and specifications," *1347 that he had "failed to make the periodic inspections or he was negligent in failing to make proper and thorough inspections," that he had "negligently approved plans and specifications which did not meet building code requirements and negligently [had] approved on-site construction which also violated the code," and that he had "issued occupancy permits for the condominiums when he knew or should have known they were in violation of the appropriate building codes." Although these allegations are insufficient to establish the existence of a special duty, they do not preclude the possibility that such a duty existed. Moreover, we are satisfied that the plaintiffs' complaint bespoke adequately of the nature of the plaintiffs' claim and the grounds upon which it rested. Bragg, 102 R.I. at 11-12, 227 A.2d at 584 (quoting Conley v. Gibson, 355 U.S. 41, 47-48, 78 S.Ct. 99, 103, 2 L.Ed.2d 80, 85-86 (1957)).
In summary, we conclude that the case before us does not present one of the rare circumstances in which the plaintiffs' pleadings leave no doubt whatsoever that the plaintiffs could not succeed at trial. Consequently, dismissal pursuant to Rule 12(b)(6) was inappropriate. Therefore, the plaintiffs' appeal is sustained, the trial justice's judgment of dismissal is reversed, and the case is remanded to the Superior Court for trial.
FLANDERS, Justice, concurring.
Although I concur fully in the court's opinion, I write separately to emphasize one practical point in dealing with complaints like this one that are potentially subject to the public-duty doctrine and its exceptions.
Because a notice-pleading zeitgeist dominates any consideration of motions filed under Rule 12(b)(6) of the Superior Court Rules of Civil Procedure, the granting of such a motion is now "virtually impossible" to obtain with respect to those claims against governmental defendants where some exception to the public-duty doctrine may be applicable. But see Ryan v. State Department of Transportation, 420 A.2d 841, 842-43 (R.I.1980) (complaint appropriately dismissed when plaintiffs failed to "allege facts that would give rise to a special duty owed to them").
But this does not mean that such defendants have no expeditious recourse short of trial to test whether a plaintiff's claim is barred by the public-duty doctrine. As our opinion in Haley v. Town of Lincoln, 611 A.2d 845, 850 (R.I.1992), makes clear, the summary-judgment rapier can be used to parry suits that touch "upon the boundaries of the public duty doctrine." Accord Catri v. Hopkins, 609 A.2d 966, 968 (R.I.1992) (summary judgment appropriately granted when plaintiff's evidence failed to "pierce the protective shell the doctrine affords"). Stated differently, even in those situations in which a plaintiff might possibly adduce facts sufficient to bring a complaint within a recognized exception to the public-duty doctrine, if the defendants have grounds to believe that no such facts exist, a summary-judgment motion can be used to seek an "early disposition" of the litigation and thereby avoid the costs and burdens of preparing for and conducting a trial. See Haley, 611 A.2d at 850.
NOTES
[1]  Rule 12(b) of the Superior Court Rules of Civil Procedure provides, in pertinent part:

"If on a motion [under 12(b)(6)] to dismiss for failure of the pleading to state a claim upon which relief can be granted, matters outside the pleading are presented to and not excluded by the court, the motion shall be treated as one for summary judgment and disposed of as provided in Rule 56."
[2]  Our holding in Haley v. Town of Lincoln, 611 A.2d 845, 850 n. 1 (R.I.1992), is applicable both to motions for a judgment on the pleadings pursuant to Rule 12(c) and to motions to dismiss for failure to state a claim pursuant to Rule 12(b)(6).
