Module: WxSugar::ListLikeItemData

Includes:
ItemData
Defined in:
lib/wx_sugar/itemdata.rb

Instance Method Summary collapse

Methods included from ItemData

#get_item_data, #set_item_data, #value_to_ident

Instance Method Details

#dataObject



34
35
36
# File 'lib/wx_sugar/itemdata.rb', line 34

def data()
  @data_table ||= Array.new()
end

#delete_item_data(the_data) ⇒ Object



38
39
40
41
42
# File 'lib/wx_sugar/itemdata.rb', line 38

def delete_item_data(the_data)
  if i = value_to_ident(the_data)
    data.delete_at(i)
  end
end

#index(the_id) ⇒ Object



54
55
56
57
58
59
# File 'lib/wx_sugar/itemdata.rb', line 54

def index(the_id)
  data.each_with_index do | val, i |
    return i if val.id == the_id
  end
  return nil
end

#push_item_data(the_data) ⇒ Object



49
50
51
52
# File 'lib/wx_sugar/itemdata.rb', line 49

def push_item_data(the_data)
  delete_item_data(the_data)
  data.push(the_data)
end

#unshift_item_data(the_data) ⇒ Object



44
45
46
47
# File 'lib/wx_sugar/itemdata.rb', line 44

def unshift_item_data(the_data)
  delete_item_data(the_data)
  data.unshift(the_data)
end