class Factory

Factory focus on three things:

1. uniform the hash
2. extend condition
3. transform the condition

Public Class Methods

new(custom={}) click to toggle source
# File lib/factory.rb, line 18
def initialize(custom={})
        @condition = uniform custom
end

Public Instance Methods

DontWantToRefactorThisBecauseItIs(too_detail) click to toggle source
# File lib/factory.rb, line 50
def DontWantToRefactorThisBecauseItIs(too_detail)
        uniform too_detail if not too_detail.is_a? String
end
checkOf(obj) click to toggle source
# File lib/factory.rb, line 54
def checkOf(obj)
        return condition.dup if obj.respond_to? :condition
        uniform(obj)
end
condition()
Alias for: to_s
magic(paragraph) click to toggle source
# File lib/factory.rb, line 46
def magic(paragraph)
        paragraph.each { |too_detail| DontWantToRefactorThisBecauseItIs too_detail }.to_set
end
merge!(custom) click to toggle source
# File lib/factory.rb, line 59
def merge! custom
        uniform custom
        dough = HashMerge.new(self.condition, custom)
        dough.baked!
        self
end
to_s() click to toggle source
# File lib/factory.rb, line 66
def to_s
        @condition
end
Also aliased as: condition
transform(base, obj=nil) click to toggle source

notify boss we have new tasks and send our base to him

# File lib/factory.rb, line 37
def transform(base, obj=nil)
        conditions = obj || condition
        projects = checkOf conditions 
        jobs = SOSHelper::Boss.new base, projects
        achievements = jobs.assign

        achievements.to_xml
end
uniform(custom) click to toggle source

uniform any hash

# File lib/factory.rb, line 23
def uniform(custom)
        custom.each do |k, v| 
                next if v.is_a? Set
                next (custom[k] = uniform v) if v.is_a? Hash
                next (custom[k] = magic v) if v.is_a? Array
                custom[k] = [v].to_set unless v.is_a? Array
                custom[k] = custom[k].to_set unless v.is_a? Set
        end           
        # p "extend filter with: " + custom.to_s
        custom
end