Sha256: 6d1f56644007ac3e4b5ff853874188c9a626ac4af586ec5eed77aded4172aa39
Contents?: true
Size: 774 Bytes
Versions: 4
Compression:
Stored size: 774 Bytes
Contents
require 'delegate' module Zertico class Delegator < SimpleDelegator def initialize(object = nil) object ||= interface_class.new super(object) end def self.find(id) new(interface_class.find(id)) end def interface __getobj__ end def interface=(object) __setobj__(object) end protected def self.interface_name self.interface_class.name.split('::').last.singularize.underscore end def self.interface_class self.name.chomp('Delegator').constantize rescue NameError self.name.chomp('Delegator').split('::').last.constantize end def interface_name self.class.interface_name end def interface_class self.class.interface_class end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
zertico-2.0.0.beta.1 | lib/zertico/delegator.rb |
zertico-2.0.0.alpha.3 | lib/zertico/delegator.rb |
zertico-2.0.0.alpha.2 | lib/zertico/delegator.rb |
zertico-2.0.0.alpha.1 | lib/zertico/delegator.rb |