Module: WxSugar::ItemData

Included in:
HashLikeItemData, ListLikeItemData
Defined in:
lib/wx_sugar/itemdata.rb

Instance Method Summary collapse

Instance Method Details

#get_item_data(id) ⇒ Object Also known as: get_client_data

for faked-up item data



4
5
6
# File 'lib/wx_sugar/itemdata.rb', line 4

def get_item_data(id)
  data[id]
end

#set_item_data(id, data_obj) ⇒ Object Also known as: set_client_data

for faked-up item data



10
11
12
# File 'lib/wx_sugar/itemdata.rb', line 10

def set_item_data(id, data_obj)
  data[id] = data_obj
end

#value_to_ident(value) ⇒ Object Also known as: object_to_item

returns the key associated with the value value



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/wx_sugar/itemdata.rb', line 16

def value_to_ident(value)
  return nil if value.nil?
  if value.nil?
    return nil
  elsif value.kind_of?(Fixnum)
    the_id = value
  elsif value.respond_to?(:id)
    the_id = value.id
  else
    Kernel.raise "Cannot search for invalid value #{value.inspect}"
  end
  return index(the_id)
end