Sha256: f9d9e515c8ad1b8648987dd7f2fd1d1808c3e1ae1bae163d135fe8ea1677dc45

Contents?: true

Size: 317 Bytes

Versions: 7

Compression:

Stored size: 317 Bytes

Contents

class Object
  def attr_accessor_nn_one(sym)
    define_method(sym) do
      res = instance_variable_get("@#{sym}")
      raise "method #{sym} cannot return nil value" unless res
      res
    end
    attr_writer(sym)
  end
  def attr_accessor_nn(*args)
    args.flatten.each { |x| attr_accessor_nn_one(x) }
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
GFunk911-mharris_ext-1.4.2 lib/mharris_ext/accessor.rb
GFunk911-mharris_ext-1.4.3 lib/mharris_ext/accessor.rb
GFunk911-mharris_ext-1.4.4 lib/mharris_ext/accessor.rb
mharris_ext-1.7.1 lib/mharris_ext/accessor.rb
mharris_ext-1.7.0 lib/mharris_ext/accessor.rb
mharris_ext-1.6.0 lib/mharris_ext/accessor.rb
mharris_ext-1.5.0 lib/mharris_ext/accessor.rb