File: README.md

package info (click to toggle)
ruby-facade 1.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 128 kB
  • sloc: ruby: 66; makefile: 4
file content (45 lines) | stat: -rw-r--r-- 1,233 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
[![Ruby](https://github.com/djberg96/facade/actions/workflows/ruby.yml/badge.svg)](https://github.com/djberg96/facade/actions/workflows/ruby.yml)

## Synopsis
An easy way to implement the facade pattern in your classes. In short,
this library wraps singleton methods from another class as instance
methods of the current class.

## Installation
`gem install facade`

## Adding the trusted cert
`gem cert --add <(curl -Ls https://raw.githubusercontent.com/djberg96/facade/main/certs/djberg96_pub.pem)`
   
## Usage
```ruby
require 'facade'

class MyString < String
  extend Facade
  facade Dir                       # extend all methods
  facade File, :dirname, :basename # extend only specified methods
end

f = MyString.new('/home/djberge')
puts f.basename # 'djberge'
puts f.dirname  # '/home'
```

## Acknowledgements
Eero Saynatkari, Eric Hodel and Michael Granger for ideas and code which I
shamelessly plagiarized.

## Copyright
Copyright (c) 2005-2023 Daniel J. Berger
   
## License
Apache-2.0

## Warranty
This package is provided "as is" and without any express or
implied warranties, including, without limitation, the implied
warranties of merchantability and fitness for a particular purpose

## Author
Daniel J. Berger