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.



139
140
141
142
# File 'lib/method_object.rb', line 139

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

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



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

def attributes
  @attributes
end

Class Method Details

.call(attributes:, subclass:) ⇒ Object



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

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

Instance Method Details

#callObject



144
145
146
147
# File 'lib/method_object.rb', line 144

def call
  define_attr_readers
  define_initializer
end