Sha256: ea3537f149b83f6123d0349c1ea07ef897ac48507b177c67e2289cef1d99e525
Contents?: true
Size: 692 Bytes
Versions: 2
Compression:
Stored size: 692 Bytes
Contents
module ClassMattr def self.included base def base.mattr name=nil if name if name.is_a?(Array) for el in name self.define_singleton_method(el) do |*args| ::ClassMattr::Proxy.new(self).send(el, *args) end end else ::ClassMattr::Proxy.new(self)._get(name) end else ::ClassMattr::Proxy.new(self) end end def base.method_added name ::ClassMattr::Proxy.new(self)._set name super end def mattr name ::ClassMattr::Proxy.new(self.class)._get(name) end end def mattr name ::ClassMattr::Proxy.new(self.class)._get(name) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
class-mattr-0.3.1 | ./lib/lib/base.rb |
class-mattr-0.3.0 | ./lib/lib/base.rb |