Class: Module

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

Instance Method Summary collapse

Instance Method Details

#param_accessor(*symbols) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/commandline/utils.rb', line 3

def param_accessor(*symbols)
  symbols.each { |sym|
    self.class_eval %{
      def #{sym}(*val)
        val.empty? ? @#{sym} : @#{sym} = val
      end
    }
  }
end