Class: FrenchMan
- Inherits:
-
Object
- Object
- FrenchMan
- Defined in:
- lib/french_man.rb
Overview
Constructs blueprints and assembles plans and has long holidays
Example usage:
FrenchMan::Login.blueprint {
username { Faker.name }
password { 'baguette' }
}
login = FrenchMan::Login.plan {
username { 'francois' }
}
login.username
=> 'francois'
login.password
=> 'baguette'
Defined Under Namespace
Classes: Blueprint, HashBuild, ObjectifiedHash, Plan
Constant Summary collapse
- VERSION =
"0.0.3"
Class Method Summary collapse
-
.const_missing(name) ⇒ Object
:nodoc:.
Class Method Details
.const_missing(name) ⇒ Object
:nodoc:
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/french_man.rb', line 22 def self.const_missing(name) #:nodoc: clazz = Class.new do def self.blueprint(&block) blueprint = Blueprint.new &block send(:class_variable_set, :@@blueprint, blueprint) end def self.plan(hash = nil, &block) blueprint = send(:class_variable_get, :@@blueprint) raise "blueprint is missing" if blueprint.nil? plan = hash.nil? ? Plan.new(&block) : HashBuild.new(hash) blueprint.merge plan.hash end end self.const_set name, clazz end |