Skip to content
This repository has been archived by the owner on Oct 23, 2021. It is now read-only.

postmodern/object_loader

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

ObjectLoader

Description

ObjectLoader can load Ruby Objects containing methods and procs from Ruby files without having to use YAML or define classes named like the file.

Examples

# file: controller.rb
class Controller

  include ObjectLoader

  # ...

end

# file: my_controller.rb
Controller.object do

  def test1
    'This is the first test'
  end

  def test2(mesg)
    "Hello #{mesg}"
  end

end

# load a Controller object from a file.
controller = Controller.load_object('my_controller.rb')
# => #<Controller: ...>

controller.test1
# => "This is the first test"
controller.test2('one two three')
# => "Hello one two three"

Install

$ gem install object_loader

Copyright

Copyright (c) 2008-2012 Hal Brodigan

See {file:LICENSE.txt} for license information.

About

Load Objects from Ruby files without having to use YAML or define classes named like the file.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages