Sha256: 8e2dd4751f5dddef76c22cf2335ab47766d6fa225aa36dfa7972fcf53e228c9e
Contents?: true
Size: 382 Bytes
Versions: 1
Compression:
Stored size: 382 Bytes
Contents
require 'rubygems' require 'bundler/setup' require 'ensure_it' class Awesome def self.define_getters(*args) args.ensure_array(:ensure_symbol, :compact).each do |n| define_method(n) { instance_variable_get("@#{n}") } end end end Awesome.define_getters(:one, 'two', nil, false, Object, :three) puts Awesome.instance_methods(false).inspect #=> [:one, :two, :three]
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ensure_it-1.0.0 | examples/array.rb |