Module: DslAccessor::Macros
- Defined in:
- lib/support/dsl_accessor.rb
Instance Method Summary collapse
Instance Method Details
#dsl_accessor(*keys) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/support/dsl_accessor.rb', line 8 def dsl_accessor(*keys) keys.map(&:to_s).each do |key| class_eval <<-ACCESSORS attr_writer :#{key} def #{key}(val = nil) if val @#{key} = val else @#{key} end end ACCESSORS end end |