module Lebowski::Foundation::ProxyFactory
Public Class Methods
create_proxy(key, parent, rel_path, driver=nil)
click to toggle source
# File lib/lebowski/foundation/proxy_factory.rb, line 17 def self.create_proxy(key, parent, rel_path, driver=nil) klass = nil if key.kind_of?(String) klass = @@proxies[key.downcase] elsif key.kind_of?(Class) and key.ancestors.member?(Lebowski::Foundation::SCObject) klass = key else raise ArgumentError.new "key is an invalid type: #{key}" end raise ArgumentError.new "proxy key not recognized: #{key}" if klass.nil? if (parent.nil? and driver.nil?) raise ArgumentError.new "must supply a driver either through the parent or driver arguments" end driver = driver.nil? ? parent.driver : driver return klass.new(parent, rel_path, driver) if rel_path.kind_of? String return klass.new(parent, "#{rel_path}", driver) if rel_path.kind_of? Integer raise ArgumentError.new "rel_path is an invalid type: #{rel_path.class}" end
has_key?(key)
click to toggle source
# File lib/lebowski/foundation/proxy_factory.rb, line 13 def self.has_key?(key) return @@proxies.has_key? key.downcase end
proxy(klass)
click to toggle source
# File lib/lebowski/foundation/proxy_factory.rb, line 42 def self.proxy(klass) if not (klass.kind_of?(Class) and klass.ancestors.member?(Lebowski::Foundation::SCObject)) raise ArgumentError.new "class must inherit Lebowski::Foundation::Object: #{klass.class}" end @@proxies[klass.represented_sc_class.downcase] = klass end