module Settings::Setting::Assignment::Attribute

Public Class Methods

assure_settable(receiver, attribute, strict=true) click to toggle source
# File lib/settings/setting/assignment.rb, line 55
def self.assure_settable(receiver, attribute, strict=true)
  if strict
    setting = setting? receiver, attribute
    unless setting
      raise "Can't set \"#{attribute}\". It isn't a setting of #{receiver.class.name}."
    end
  end

  assignable = assignable?(receiver, attribute)
  unless assignable
    raise "Can't set \"#{attribute}\". It isn't assignable to #{receiver.class.name}."
  end

  true
end