Class: Conflow::Redis::FieldBuilder Private

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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.

See Also:



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_nameObject (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

#klassObject (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