Class: Module

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

Instance Method Summary collapse

Instance Method Details

#dsl_property(*symbols) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/maestro/dsl_property.rb', line 2

def dsl_property(*symbols)
  symbols.each do |sym|
    class_eval %{
      def #{sym}(*val)
        if val.empty?
          @#{sym}
        else
          @#{sym} = val.size == 1 ? val[0] : val
        end
      end
    }
  end
end