Class: EacRubyUtils::CommonConstructor::ClassAccessors
- Defined in:
- lib/eac_ruby_utils/common_constructor/class_accessors.rb
Instance Attribute Summary collapse
-
#common_constructor ⇒ Object
readonly
Returns the value of attribute common_constructor.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
Instance Method Summary collapse
- #args ⇒ Object
-
#initialize(common_constructor, klass) ⇒ ClassAccessors
constructor
A new instance of ClassAccessors.
- #perform ⇒ Object
- #setup_class_attr_readers ⇒ Object
- #setup_class_attr_writers ⇒ Object
Constructor Details
#initialize(common_constructor, klass) ⇒ ClassAccessors
Returns a new instance of ClassAccessors.
11 12 13 14 |
# File 'lib/eac_ruby_utils/common_constructor/class_accessors.rb', line 11 def initialize(common_constructor, klass) @common_constructor = common_constructor @klass = klass end |
Instance Attribute Details
#common_constructor ⇒ Object (readonly)
Returns the value of attribute common_constructor.
9 10 11 |
# File 'lib/eac_ruby_utils/common_constructor/class_accessors.rb', line 9 def common_constructor @common_constructor end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
9 10 11 |
# File 'lib/eac_ruby_utils/common_constructor/class_accessors.rb', line 9 def klass @klass end |
Instance Method Details
#args ⇒ Object
16 17 18 |
# File 'lib/eac_ruby_utils/common_constructor/class_accessors.rb', line 16 def args common_constructor.all_args end |
#perform ⇒ Object
20 21 22 23 |
# File 'lib/eac_ruby_utils/common_constructor/class_accessors.rb', line 20 def perform setup_class_attr_readers setup_class_attr_writers end |
#setup_class_attr_readers ⇒ Object
25 26 27 28 |
# File 'lib/eac_ruby_utils/common_constructor/class_accessors.rb', line 25 def setup_class_attr_readers klass.send(:attr_reader, *args) klass.send(:public, *args) if args.any? end |
#setup_class_attr_writers ⇒ Object
30 31 32 33 |
# File 'lib/eac_ruby_utils/common_constructor/class_accessors.rb', line 30 def setup_class_attr_writers klass.send(:attr_writer, *args) klass.send(:private, *args.map { |a| "#{a}=" }) if args.any? end |