Sha256: 2192270740aa92395d9761022d42bb9a4c6b399dd9a265025139dab8f6744156
Contents?: true
Size: 889 Bytes
Versions: 5
Compression:
Stored size: 889 Bytes
Contents
module Finitio class ProxyType < Type def initialize(target_name, target = nil) unless target_name.is_a?(String) raise ArgumentError, "String expected for type name, got `#{target_name}`" end @target_name = target_name @target = target end attr_reader :target_name, :target [ :representator, :name, :name=, :default_name, :dress, :undress, :include?, :==, :eql?, :hash, :to_s ].each do |meth| define_method(meth) do |*args, &bl| raise Error, "No such type `#{@target_name}` (proxy not resolved?)" unless @target @target.send(meth, *args, &bl) end end def resolve(system) @target = system.fetch(target_name){ raise Error, "No such type `#{target_name}`" } end end # class ProxyType end # module Finitio
Version data entries
5 entries across 5 versions & 1 rubygems