File: README.md

package info (click to toggle)
ruby-instantiator 0.0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 152 kB
  • sloc: ruby: 269; makefile: 2
file content (19 lines) | stat: -rw-r--r-- 701 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
## Instantiator [![Build Status](https://travis-ci.org/floehopper/instantiator.svg?branch=master)](https://travis-ci.org/floehopper/instantiator) [![Gem Version](https://badge.fury.io/rb/instantiator.png)](http://badge.fury.io/rb/instantiator)

I want to be able to instantiate an arbitrary Ruby class without knowing anything about the constructor.

The initial requirement for this has come from my [Introspection](https://github.com/floehopper/introspection) project.

### Usage

    class ArbitraryClass
      def initialize(arg1, arg2, *other_args)
        # stuff
      end
    end

    require "instantiator"

    instance = ArbitraryClass.instantiate

    p instance.class # => ArbitraryClass