class Fried::Schema::SetAttribute

Set attribute value on object

Public Class Methods

build() click to toggle source
# File lib/fried/schema/set_attribute.rb, line 6
def self.build
  new
end
call(obj, attribute, value) click to toggle source
# File lib/fried/schema/set_attribute.rb, line 10
def self.call(obj, attribute, value)
  instance = build
  instance.(obj, attribute, value)
end

Public Instance Methods

call(obj, attribute, value) click to toggle source

@param obj [Object] anything @param attribute [Attribute::Definition] @param value [Object] anything @return [Object] the passed value

# File lib/fried/schema/set_attribute.rb, line 19
def call(obj, attribute, value)
  writer = attribute.writer
  obj.public_send(writer, value)
end