class Fried::Schema::SetAttributeWithoutChecks

Set attribute value on object skipping type-checking

Public Class Methods

build() click to toggle source
# File lib/fried/schema/set_attribute_without_checks.rb, line 6
def self.build
  new
end
call(obj, attribute, value) click to toggle source
# File lib/fried/schema/set_attribute_without_checks.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_without_checks.rb, line 19
def call(obj, attribute, value)
  variable = attribute.instance_variable
  obj.instance_variable_set(variable, value)
end