Sha256: dbad4d6fbb233c8beae1cc6757b3a77c1595d176b31bd6386ef14209714a2d86

Contents?: true

Size: 292 Bytes

Versions: 16

Compression:

Stored size: 292 Bytes

Contents

def setter(name)
  define_method(name) do |value|
    ivar = "@#{name}"
    instance_variable_set(ivar, value)
  end
  
  define_method("value_of_#{name}") do
    ivar = "@#{name}"
    if (instance_variable_get(ivar))
      instance_variable_get(ivar)
    else
      nil
    end
  end
  
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rcoli-0.7.1 lib/rcoli/extensions.rb
rcoli-0.7.0 lib/rcoli/extensions.rb
rcoli-0.6.8 lib/rcoli/extensions.rb
rcoli-0.6.7 lib/rcoli/extensions.rb
rcoli-0.6.6 lib/rcoli/extensions.rb
rcoli-0.6.5 lib/rcoli/extensions.rb
rcoli-0.6.4 lib/rcoli/extensions.rb
rcoli-0.6.3 lib/rcoli/extensions.rb
rcoli-0.6.2 lib/rcoli/extensions.rb
rcoli-0.6.1 lib/rcoli/extensions.rb
rcoli-0.6.0 lib/rcoli/extensions.rb
rcoli-0.5.12 lib/rcoli/extensions.rb
rcoli-0.5.11 lib/rcoli/extensions.rb
rcoli-0.5.10 lib/rcoli/extensions.rb
rcoli-0.5.9 lib/rcoli/extensions.rb
rcoli-0.5.8 lib/rcoli/extensions.rb