Skip to content

eventide-project/configure

Repository files navigation

Configure

Examples

Activation

Default

require 'configure'; Configure.activate

Specifying a default factory method

The configure library will use .build as the factory method by default. To override, supply factory_method to Configure.activate:

require 'configure'; Configure.activate factory_method: :create

Usage

Defining a configure method

class SomeClass
  configure :some_attr_name
end

Configuring a receiver

receiver = OpenStruct.new

SomeClass.configure receiver

# Returns instance of SomeClass
receiver.some_attr_name

Specifying the attribute name on the receiver

receiver = OpenStruct.new

SomeClass.configure receiver, attr_name: :other_attr_name

# Returns instance of SomeClass
receiver.other_attr_name

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •