Sha256: 5db19c6e0ef2ae59463176b2099cbc0451835fa57cf5f6fea3207c7a75e4f7f3

Contents?: true

Size: 286 Bytes

Versions: 1

Compression:

Stored size: 286 Bytes

Contents

class Class
  def kattr_reader(*syms)
    syms.each do |sym|
      self.class.send(:define_method, sym) do
        return nil unless class_variable_defined? "@@#{sym}"
        return class_variable_get "@@#{sym}" 
      end
    end
  end
  alias_method :cattr_reader, :kattr_reader
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kattr-0.0.1 lib/kattr/reader.rb