Class: Module

Inherits:
Object
  • Object
show all
Defined in:
lib/core_extensions.rb

Instance Method Summary collapse

Instance Method Details

#flag(*names) ⇒ Object


32
33
34
35
36
37
38
39
40
41
# File 'lib/core_extensions.rb', line 32

def flag(*names)
  names.each do |name|
    define_method "#{name}!" do
      instance_variable_set "@#{name}", true
    end
    define_method "#{name}?" do
      instance_variable_get "@#{name}"
    end
  end
end