Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/magica/extension.rb
Overview
:nodoc:
Class Method Summary collapse
-
.attr_block(*syms) ⇒ Object
rubocop:disable Metrics/LineLength.
Class Method Details
.attr_block(*syms) ⇒ Object
rubocop:disable Metrics/LineLength
5 6 7 8 9 |
# File 'lib/magica/extension.rb', line 5 def attr_block(*syms) syms.flatten.each do |sym| class_eval "def #{sym}(&block); block.call(#{sym}) if block_given?; @#{sym}; end" end end |