Class: MethodObject::Setup

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/method_object.rb

Overview

Dynamically defines custom attr_readers and initializer.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes, subclass) ⇒ Setup

Returns a new instance of Setup.



136
137
138
139
# File 'lib/method_object.rb', line 136

def initialize(attributes, subclass)
  self.attributes = attributes
  super(subclass)
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



134
135
136
# File 'lib/method_object.rb', line 134

def attributes
  @attributes
end

Class Method Details

.call(attributes:, subclass:) ⇒ Object



130
131
132
# File 'lib/method_object.rb', line 130

def self.call(attributes:, subclass:)
  new(attributes, subclass).call
end

Instance Method Details

#callObject



141
142
143
144
# File 'lib/method_object.rb', line 141

def call
  define_attr_readers
  define_initializer
end