Sha256: f9149c79cfbb19e91b178d65d9f4fd0ad05370e3028db97469e6d7af0810196e
Contents?: true
Size: 1006 Bytes
Versions: 1
Compression:
Stored size: 1006 Bytes
Contents
module Zertico class Accessor def initialize(object) instance_variable_set("@#{interface_name}", object) end def self.find(id) instance_variable_set("@#{interface_name}", interface_class.find(id)) self end def method_missing(method_name, *args) if instance_variable_get("@#{interface_name}").respond_to?(method_name) return instance_variable_get("@#{interface_name}").send(method_name, *args) end super end def respond_to_missing?(method_name, include_private = false) return true if interface_class.respond_to?(method_name) super end protected def self.interface_name self.name.chomp('Accessor').singularize.underscore end def interface_name self.class.name.chomp('Accessor').singularize.underscore end def self.interface_class self.interface_name.camelize.constantize end def interface_class self.interface_name.camelize.constantize end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
zertico-0.3.0 | lib/zertico/accessor.rb |