Class: ActiveDelegate::Attribute::Methods

Inherits:
Object
  • Object
show all
Defined in:
lib/active_delegate/attribute/methods.rb

Overview

Generates attribute method names

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attribute_name, association_class, writer:, dirty:) ⇒ Methods

Returns a new instance of Methods.



9
10
11
12
13
14
# File 'lib/active_delegate/attribute/methods.rb', line 9

def initialize(attribute_name, association_class, writer:, dirty:)
  @define_writer        = writer
  @define_dirty         = dirty
  @attribute_name       = attribute_name
  @association_instance = association_class.new
end

Instance Attribute Details

#association_instanceObject (readonly)

Returns the value of attribute association_instance.



7
8
9
# File 'lib/active_delegate/attribute/methods.rb', line 7

def association_instance
  @association_instance
end

#attribute_nameObject (readonly)

Returns the value of attribute attribute_name.



7
8
9
# File 'lib/active_delegate/attribute/methods.rb', line 7

def attribute_name
  @attribute_name
end

Instance Method Details

#accessorsObject



16
17
18
# File 'lib/active_delegate/attribute/methods.rb', line 16

def accessors
  suffix_attribute(accessor_suffixes)
end

#delegatableObject



24
25
26
# File 'lib/active_delegate/attribute/methods.rb', line 24

def delegatable
  accessors + dirty
end

#dirtyObject



20
21
22
# File 'lib/active_delegate/attribute/methods.rb', line 20

def dirty
  suffix_attribute(dirty_suffixes)
end