Class: Conflow::Redis::FieldBuilder Private
- Inherits:
-
Object
- Object
- Conflow::Redis::FieldBuilder
- Defined in:
- lib/conflow/redis/field_builder.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Helper class for defining getter and setter methods for Fields
Defined Under Namespace
Classes: FieldAccessor
Instance Attribute Summary collapse
-
#field_name ⇒ Object
readonly
private
Name of the accessor methods.
-
#klass ⇒ Object
readonly
private
Class of the field.
Instance Method Summary collapse
-
#call(base, methods: %i[getter setter]) ⇒ Object
private
Creates dynamic FieldAccessor module and includes it in base class.
-
#initialize(field_name, klass) ⇒ FieldBuilder
constructor
private
A new instance of FieldBuilder.
Constructor Details
#initialize(field_name, klass) ⇒ FieldBuilder
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of FieldBuilder.
43 44 45 46 |
# File 'lib/conflow/redis/field_builder.rb', line 43 def initialize(field_name, klass) @field_name = field_name @klass = klass end |
Instance Attribute Details
#field_name ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Name of the accessor methods
37 38 39 |
# File 'lib/conflow/redis/field_builder.rb', line 37 def field_name @field_name end |
#klass ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Class of the field. Should inherit from Conflow::Redis::Field
39 40 41 |
# File 'lib/conflow/redis/field_builder.rb', line 39 def klass @klass end |
Instance Method Details
#call(base, methods: %i[getter setter]) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Creates dynamic FieldAccessor module and includes it in base class
49 50 51 |
# File 'lib/conflow/redis/field_builder.rb', line 49 def call(base, methods: %i[getter setter]) base.include(FieldAccessor.new(field_name, klass, methods)) end |