Class: HotCocoa::ComboBoxDataSource

Inherits:
Object
  • Object
show all
Defined in:
lib/hotcocoa/data_sources/combo_box_data_source.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ ComboBoxDataSource

Returns a new instance of ComboBoxDataSource.



5
6
7
# File 'lib/hotcocoa/data_sources/combo_box_data_source.rb', line 5

def initialize data
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



3
4
5
# File 'lib/hotcocoa/data_sources/combo_box_data_source.rb', line 3

def data
  @data
end

Instance Method Details

#comboBox(combo_box, objectValueForItemAtIndex: index) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/hotcocoa/data_sources/combo_box_data_source.rb', line 9

def comboBox combo_box, completedString: string
  data.length.times do |index|
    value = string_value_of_index index
    return value if value.start_with? string
  end

  nil
end

#numberOfItemsInComboBox(combo_box) ⇒ Object



30
31
32
# File 'lib/hotcocoa/data_sources/combo_box_data_source.rb', line 30

def numberOfItemsInComboBox combo_box
  data.length
end