daremkd
daremkd

Reputation: 8424

What is a wrapper (in Ruby APIs)

In Ruby APIs like here: http://ruby-doc.org/stdlib-2.0.0/libdoc/open-uri/rdoc/OpenURI.html I often encounter this term, for example "OpenURI is an easy-to-use wrapper for Net::HTTP, Net::HTTPS and Net::FTP."

What is a wrapper in this context?

Upvotes: 2

Views: 281

Answers (1)

Roberto Poo
Roberto Poo

Reputation: 433

A Wrapper is a class that provides an alternative interface to some other class.

In your example, OpenURI provides a different way to use http or ftp connections as if they were Files. In this case, OpenURI "wraps" the functionality of Net::HTTP, Net::HTTPS and Net::FTP and provides a different way to use those classes.

Upvotes: 3

Related Questions