Class: Memorium::InitializeAttr
- Inherits:
-
Object
- Object
- Memorium::InitializeAttr
- Defined in:
- lib/memorium/initialize_attr.rb
Defined Under Namespace
Classes: Interaction, Template
Constant Summary collapse
- ACCESSOR =
'@__initialize_attributes'.freeze
Instance Attribute Summary collapse
-
#attr_name ⇒ Object
readonly
Returns the value of attribute attr_name.
-
#initialized ⇒ Object
readonly
Returns the value of attribute initialized.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#reader_level ⇒ Object
readonly
Returns the value of attribute reader_level.
-
#required ⇒ Object
readonly
Returns the value of attribute required.
-
#writer_level ⇒ Object
readonly
Returns the value of attribute writer_level.
Instance Method Summary collapse
- #define ⇒ Object
-
#initialize(klass, attr_name, reader: nil, writer: nil, required: nil, initialized: false) ⇒ InitializeAttr
constructor
A new instance of InitializeAttr.
Constructor Details
#initialize(klass, attr_name, reader: nil, writer: nil, required: nil, initialized: false) ⇒ InitializeAttr
Returns a new instance of InitializeAttr.
6 7 8 9 10 11 12 13 14 |
# File 'lib/memorium/initialize_attr.rb', line 6 def initialize(klass, attr_name, reader: nil, writer: nil, required: nil, initialized: false) @klass = klass @attr_name = attr_name @reader_level = reader || Memorium::AccessLevel::PUBLIC @writer_level = writer || Memorium::AccessLevel::PUBLIC @required = required @initialized = initialized end |
Instance Attribute Details
#attr_name ⇒ Object (readonly)
Returns the value of attribute attr_name.
4 5 6 |
# File 'lib/memorium/initialize_attr.rb', line 4 def attr_name @attr_name end |
#initialized ⇒ Object (readonly)
Returns the value of attribute initialized.
4 5 6 |
# File 'lib/memorium/initialize_attr.rb', line 4 def initialized @initialized end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
4 5 6 |
# File 'lib/memorium/initialize_attr.rb', line 4 def klass @klass end |
#reader_level ⇒ Object (readonly)
Returns the value of attribute reader_level.
4 5 6 |
# File 'lib/memorium/initialize_attr.rb', line 4 def reader_level @reader_level end |
#required ⇒ Object (readonly)
Returns the value of attribute required.
4 5 6 |
# File 'lib/memorium/initialize_attr.rb', line 4 def required @required end |
#writer_level ⇒ Object (readonly)
Returns the value of attribute writer_level.
4 5 6 |
# File 'lib/memorium/initialize_attr.rb', line 4 def writer_level @writer_level end |
Instance Method Details
#define ⇒ Object
16 17 18 19 20 21 |
# File 'lib/memorium/initialize_attr.rb', line 16 def define create_methods apply_reader_access_level apply_writer_access_level end |