Setter- called by update_extras in properties controller
 expects a hash with keys like "cl.casafactory.fieldLabels.extras.alarma"
 each with a value of true or false
768768
def set_features=(features_json)
      # return unless features_json.class == Hash
      features_json.keys.each do |feature_key|
        # TODO - create feature_key if its missing
        if features_json[feature_key] == "true" || features_json[feature_key] == true
          features.find_or_create_by( feature_key: feature_key)
        else
          features.where( feature_key: feature_key).delete_all
        end
      end
    end
1247863
def set(name, contents = '', type = 500)
      sd = @client.sd.update(name, contents)
      if sd.is_a?(Hash) && (sd["errorCode"] == -22) # doesn't exist
        sd = @client.sd.create(name, contents)
      end
      sd
    end
1099101
def set?(key)
      check_key!(key)
      expires!(key)
      @data.keys.include?(key.to_s)
    end
993458
def set_custom(self, key, value=None):
        
        # Split combined key/value
        if value is None:
            try:
                key, value = key.split('=', 1)
            except (ValueError, TypeError) as exc:
                raise error.UserError("Bad custom field assignment %r, probably missing a '=' (%s)" % (key, exc))

        # Check identifier rules
        if not key:
            raise error.UserError("Custom field name cannot be empty!")
        elif len(key) == 1 and key in "12345":
            method, args = "custom"+key+".set", (value,)
        elif not (key[0].isalpha() and key.replace("_", "").isalnum()):
            raise error.UserError("Bad custom field name %r (must only contain a-z, A-Z, 0-9 and _)" % (key,))
        else:
            method, args = "custom.set", (key, value)

        # Make the assignment
        self._make_it_so("setting custom_%s = %r on" % (key, value), [method], *args)
        self._fields["custom_"+key] = value
1353727
void set_properties(AttributeConfig conf,String dev_name) throws DevFailed
	{

//
// Copy only a sub-set of the new properties
//

		description = conf.description;
		label = conf.label;
		unit = conf.unit;
		standard_unit = conf.standard_unit;
		display_unit = conf.display_unit;
		format = conf.format;

//
// For the last four properties, convert their value to the right type
//

		min_alarm_str = conf.min_alarm;
		if ((min_alarm_str.equals(Tango_AlrmValueNotSpec) == false) &&
		    (data_type != Tango_DEV_STRING) && (data_type != Tango_DEV_BOOLEAN))
		{
			try
			{
				switch (data_type)
				{
				case Tango_DEV_SHORT:
					min_alarm.sh = Short.parseShort(min_alarm_str);
					break;
			
				case Tango_DEV_LONG:
					min_alarm.lg = Integer.parseInt(min_alarm_str);
					break;
			
				case Tango_DEV_DOUBLE:
					min_alarm.db = Double.valueOf(min_alarm_str);
					break;
				}
			}
			catch (NumberFormatException ex)
			{
				throw_err_format("min_alarm",dev_name);
			}
			check_min_alarm = true;
		}
		else
			check_min_value = false;
	
//
// Init the max alarm property
//

		max_alarm_str = conf.max_alarm;
		if ((max_alarm_str.equals(Tango_AlrmValueNotSpec) == false) && 
		    (data_type != Tango_DEV_STRING) && (data_type != Tango_DEV_BOOLEAN))
		{
			try
			{
				switch (data_type)
				{
				case Tango_DEV_SHORT:
					max_alarm.sh = Short.parseShort(max_alarm_str);
					break;
			
				case Tango_DEV_LONG:
					max_alarm.lg = Integer.parseInt(max_alarm_str);
					break;
			
				case Tango_DEV_DOUBLE:
					max_alarm.db = Double.valueOf(max_alarm_str);
					break;
				}
			}
			catch (NumberFormatException ex)
			{
				throw_err_format("max_alarm",dev_name);
			}
			check_max_alarm = true;
		}
		else
			check_max_alarm = false;
		
//
// Init the min value property
//

		min_value_str = conf.min_value;
		if ((min_value_str.equals(Tango_AlrmValueNotSpec) == false) && 
		    (data_type != Tango_DEV_STRING) && (data_type != Tango_DEV_BOOLEAN))
		{
			try
			{
				switch (data_type)
				{
				case Tango_DEV_SHORT:
					min_value.sh = Short.parseShort(min_value_str);
					break;
			
				case Tango_DEV_LONG:
					min_value.lg = Integer.parseInt(min_value_str);
					break;
			
				case Tango_DEV_DOUBLE:
					min_value.db = Double.valueOf(min_value_str);
					break;
				}
			}
			catch (NumberFormatException ex)
			{
				throw_err_format("min_value",dev_name);
			}
			check_min_value = true;
		}
		else
			check_min_value = false;
		
//
// Init the max value property
//

		max_value_str = conf.max_value;
		if ((max_value_str.equals(Tango_AlrmValueNotSpec) == false) && 
		    (data_type != Tango_DEV_STRING) && (data_type != Tango_DEV_BOOLEAN))
		{
			try
			{
				switch (data_type)
				{
				case Tango_DEV_SHORT:
					max_value.sh = Short.parseShort(max_value_str);
					break;
			
				case Tango_DEV_LONG:
					max_value.lg = Integer.parseInt(max_value_str);
					break;
			
				case Tango_DEV_DOUBLE:
					max_value.db = Double.valueOf(max_value_str);
					break;
				}
			}
			catch (NumberFormatException ex)
			{
				throw_err_format("max_value",dev_name);
			}			
			check_max_value = true;
		}
		else
			check_max_value = false;
	}
486085
function setOptions(schema, options) {
  function setDefaults(array) {
    if (!array.length) {
      if (options.find) { array.push('find'); }
      if (options.findOne || !options.find) { array.push('findOne'); }
    }
  }

  options = options || {};

  options.only = options.only || [];
  options.validateBeforeSave = options.validateBeforeSave === undefined
                                ? schema.options.validateBeforeSave
                                : Boolean(options.validateBeforeSave);

  ['virtual', 'attach', 'modify'].filter(prop => options[prop])
    .forEach(
      prop => {
        if (typeof options[prop] !== 'object') {
          options[prop] = {};
        }
        options[prop].properties = options[prop].properties || {};
        options[prop].only = options[prop].only || Object.keys(options[prop].properties);
      }
    );

  if (options.modify) {
    delete options.modify.properties;
    options.modify.on = options.modify.on || [];
    setDefaults(options.modify.on);
  }
  if (options.attach) {
    Object.keys(options.attach.properties).forEach(property => {
      options.attach.properties[property].on = options.attach.properties[property].on || [];
      setDefaults(options.attach.properties[property].on);
    });
  }

  return options;
}
218399
def do_alarm_update(mc, args):
    ''''''
    fields = {}
    fields['alarm_id'] = args.id
    if args.state.upper() not in state_types:
            errmsg = ('Invalid state, not one of [' +
                      ', '.join(state_types) + ']')
            print(errmsg)
            return
    fields['state'] = args.state
    fields['lifecycle_state'] = args.lifecycle_state
    fields['link'] = args.link
    try:
        alarm = mc.alarms.update(**fields)
    except (osc_exc.ClientException, k_exc.HttpError) as he:
        raise osc_exc.CommandError('%s\n%s' % (he.message, he.details))
    else:
        print(jsonutils.dumps(alarm, indent=2))
831632
function _$add(prop, value, lazyEmit) {
        if (prop.match(/[\.\[\]]/)) {
            throw new Error('Propname shoudn\'t contains "." or "[" or "]"')
        }

        if ($indexOf(_observableKeys, prop)) {
            // If value is specified, reset value
            return arguments.length > 1 ? true : false
        }
        _props[prop] = _walk(prop, $util.copyValue(value))
        _observableKeys.push(prop)
        $util.def(model, prop, {
            enumerable: true,
            get: function() {
                return _props[prop]
            },
            set: function (v) {
                _$set(prop, v)
            }
        })
        // add peroperty will trigger change event
        if (!lazyEmit) {
            _emitChange(prop, value)
        } else {
            return {
                kp: prop,
                vl: value
            }
        }
    }
1180594
def custom_fields_safe_setters
      self.custom_fields_recipe['rules'].map do |rule|
        case rule['type'].to_sym
        when :date, :date_time, :money  then "formatted_#{rule['name']}"
        when :file                      then [rule['name'], "remove_#{rule['name']}", "remote_#{rule['name']}_url"]
        when :select, :belongs_to       then ["#{rule['name']}_id", "position_in_#{rule['name']}"]
        when :has_many, :many_to_many   then nil
        else
          rule['name']
        end
      end.compact.flatten
    end
534386
function fixBools(attrs) {
        var self = this;
        _.each(attrs, function each(value, key) {
            if (schema.tables[self.tableName].hasOwnProperty(key)
                && schema.tables[self.tableName][key].type === 'bool') {
                attrs[key] = value ? true : false;
            }
        });

        return attrs;
    }
28900
def update_with(&blk)
      self.class.options.each do |name, config|
        value = yield(config)
        @values[name] = value unless value.nil?
      end
    end
530
def setup
      set_descriptor :default 

      get_mxit_info

      @_mxit = descriptor
      @_mxit_validated = true
      @_mxit_validation_types = []
      @_mxit_validation_messages = []
      @_mxit_emulator = request.headers['X-Mxit-UserId-R'].nil?

      clean_session

      # Tidy multi-select if needed
      if params.include? :_mxit_rails_multi_select
        input = params[:_mxit_rails_multi_select].to_sym
        params.delete :_mxit_rails_multi_select

        array = mxit_form_session[input] || []
        array.map! {|item| item.to_sym}
        set = Set.new array

        if params.include? :_mxit_rails_multi_select_value
          value = params[:_mxit_rails_multi_select_value].to_sym
          params.delete :_mxit_rails_multi_select_value
          if set.include? value
            set.delete value
          else
            set.add value
          end
        end

        params[input] = set.to_a.map {|item| item.to_s}
        mxit_form_session[input] = set.to_a.map {|item| item.to_sym}
      end
    end
752614
def update(hash = {})
      hash.each do |k,v|
        # The name of the setter for the value of k
        setter = "#{k}="

        # Check if there is a matching setter
        if self.respond_to?(setter)
          # Yes, there is. Call the setter with the value
          self.send(setter, v)
        end
      end

      self
    end
134557
def update(properties, raw = false)
      properties.each do |property, value|
        update_property(property, value, raw)
      end
    end
230918
function defineBooleanAttribute (key, handler) {
    var attr = $attrs.$normalize('md-' + key);
    if (handler) defineProperty(key, handler);
    if ($attrs.hasOwnProperty(attr)) updateValue($attrs[attr]);
    $attrs.$observe(attr, updateValue);
    function updateValue (newValue) {
      ctrl[ key ] = newValue !== 'false';
    }
  }
1282034
def set(key, value = nil)
      if key.is_a?(Hash)
        properties.merge!(key)
      else
        properties[key] = value
      end
    end
374230
def method_missing(meth, value)
      meth = sanitize_setter_method(meth)

      if defaults.key?(meth)
        @options[meth] = value
      else
        super
      end
    end