Sha256: fd3bada3dd7b72e9d2be030895d131a00f2b8f4136576a585b4215f50dc1e1e4
Contents?: true
Size: 511 Bytes
Versions: 3
Compression:
Stored size: 511 Bytes
Contents
module Falcor module ClassAttrs class << self def included(base) base.extend ClassMethods end end module ClassMethods def class_attr(attr_name) (class << self; self; end).instance_eval { define_method attr_name.intern do instance_variable_get("@#{attr_name}") end define_method "#{attr_name}=".intern do |val| instance_variable_set("@#{attr_name}", val) end } end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
falcor-0.0.3 | lib/falcor/class_attrs.rb |
falcor-0.0.2 | lib/falcor/class_attrs.rb |
falcor-0.0.1 | lib/falcor/class_attrs.rb |