def write(name, target_value)
      if name.is_a?(Symbol)
        self.write(@field_list[name], target_value)
      elsif name.is_a?(Integer)
        self.update self.field.write_bits(name => @options[:bool_caster].call(target_value))
      elsif name.respond_to?(:[]) and target_value.respond_to?(:[])
        bits = {}
        
        name.each_with_index do |bit, i|
          bits[bit] = @options[:bool_caster].call(target_value[i])
        end
        
        self.update self.field.write_bits bits
      end
    end
def write(name, target_value)
      if name.is_a?(Symbol)
        self.write(@field_list[name], target_value)
      elsif name.is_a?(Integer)
        self.update self.field.write_bits(name => @options[:bool_caster].call(target_value))
      elsif name.respond_to?(:[]) and target_value.respond_to?(:[])
        bits = {}
        
        name.each_with_index do |bit, i|
          bits[bit] = @options[:bool_caster].call(target_value[i])
        end
        
        self.update self.field.write_bits bits
      end
    end
Write a field or bit from its field name or index

 Note: only the total bits of the field is used from the given value, so
 any additional bits are ignored. eg: writing a field with one bit as value
 of 4 will set the bit to 0, writing 5 sets it to 1.

 @param [Symbol, Integer, Array<Integer>] name a field name, or bit position,
   or array of bit positions
 @param [Integer, Array<Integer>] target_value the target value for the field
   (note: technically, this can be anything that responds to :[](index), but
   usage in that type of context is discouraged without adapter support)

 @example Write values to bit fields
   # The struct is just an example, normally you would define a new class
   Example = Struct.new('Example', :flags)
   exo = Example.new(0)
   bits = Bits.new(exo, {:is_odd => 0, :amount => [1, 2, 3], :is_cool => 4})
   bits.write(:is_odd, 1) #=> 1
   bits.write(:amount, 5) #=> 11
   exo.flags #=> 11
   # Bonus, aliased as :[]=, but note in this mode, the return value is same as given value
   bits[:is_cool] = 1 #=> 1
   exo.flags #=> 27

 @return the return value of the updater Proc, usually is equal to the final
   master value (with all the bits) after writing this bit