Class: Fried::Schema::GetAttribute
- Inherits:
-
Object
- Object
- Fried::Schema::GetAttribute
- Defined in:
- lib/fried/schema/get_attribute.rb
Overview
Get attribute value from object
Class Method Summary collapse
Instance Method Summary collapse
-
#call(obj, attribute) ⇒ Object
Value from the object attribute.
Class Method Details
.build ⇒ Object
6 7 8 |
# File 'lib/fried/schema/get_attribute.rb', line 6 def self.build new end |
.call(obj, attribute) ⇒ Object
10 11 12 13 |
# File 'lib/fried/schema/get_attribute.rb', line 10 def self.call(obj, attribute) instance = build instance.(obj, attribute) end |
Instance Method Details
#call(obj, attribute) ⇒ Object
Returns value from the object attribute.
18 19 20 21 |
# File 'lib/fried/schema/get_attribute.rb', line 18 def call(obj, attribute) reader = attribute.reader obj.public_send(reader) end |