Module: BuildTool::Commands::ClassAttribute
- Included in:
- HelpText::ClassMethods
- Defined in:
- lib/build-tool/commands.rb
Overview
Mixin which allows defining attribute easily
Instance Method Summary collapse
Instance Method Details
#def_attribute(*names) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/build-tool/commands.rb', line 21 def def_attribute( *names ) class_eval do names.each do |name| define_method( name ) do |*args| case args.size when 0 then instance_variable_get( "@#{name}" ) else instance_variable_set( "@#{name}", *args ) end end end end end |