[macruby-changes] [325] MacRuby/trunk/lib
source_changes at macosforge.org
source_changes at macosforge.org
Mon Jul 7 20:35:13 PDT 2008
Revision: 325
http://trac.macosforge.org/projects/ruby/changeset/325
Author: rich at infoether.com
Date: 2008-07-07 20:35:13 -0700 (Mon, 07 Jul 2008)
Log Message:
-----------
move data sources
Modified Paths:
--------------
MacRuby/trunk/lib/hotcocoa.rb
Added Paths:
-----------
MacRuby/trunk/lib/hotcocoa/data_sources/combo_box_data_source.rb
MacRuby/trunk/lib/hotcocoa/data_sources/table_data_source.rb
Removed Paths:
-------------
MacRuby/trunk/lib/hotcocoa/combo_box_data_source.rb
MacRuby/trunk/lib/hotcocoa/table_data_source.rb
Deleted: MacRuby/trunk/lib/hotcocoa/combo_box_data_source.rb
===================================================================
--- MacRuby/trunk/lib/hotcocoa/combo_box_data_source.rb 2008-07-08 03:33:32 UTC (rev 324)
+++ MacRuby/trunk/lib/hotcocoa/combo_box_data_source.rb 2008-07-08 03:35:13 UTC (rev 325)
@@ -1,44 +0,0 @@
-module HotCocoa
- class ComboBoxDataSource
- attr_reader :data
-
- def initialize(data)
- @data = data
- end
-
- 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
-
- def comboBox(combo_box, indexOfItemWithStringValue:string)
- data.length.times do |index|
- return index if string_value_of_index(index) == string
- end
- NSNotFound
- end
-
- def comboBox(combo_box, objectValueForItemAtIndex:index)
- string_value_of_index(index)
- end
-
- def numberOfItemsInComboBox(combo_box)
- data.length
- end
-
- private
-
- def string_value_of_index(i)
- item = data[i]
- if item.kind_of?(Hash)
- item.values.first
- else
- item.to_s
- end
- end
-
- end
-end
Copied: MacRuby/trunk/lib/hotcocoa/data_sources/combo_box_data_source.rb (from rev 323, MacRuby/trunk/lib/hotcocoa/combo_box_data_source.rb)
===================================================================
--- MacRuby/trunk/lib/hotcocoa/data_sources/combo_box_data_source.rb (rev 0)
+++ MacRuby/trunk/lib/hotcocoa/data_sources/combo_box_data_source.rb 2008-07-08 03:35:13 UTC (rev 325)
@@ -0,0 +1,44 @@
+module HotCocoa
+ class ComboBoxDataSource
+ attr_reader :data
+
+ def initialize(data)
+ @data = data
+ end
+
+ 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
+
+ def comboBox(combo_box, indexOfItemWithStringValue:string)
+ data.length.times do |index|
+ return index if string_value_of_index(index) == string
+ end
+ NSNotFound
+ end
+
+ def comboBox(combo_box, objectValueForItemAtIndex:index)
+ string_value_of_index(index)
+ end
+
+ def numberOfItemsInComboBox(combo_box)
+ data.length
+ end
+
+ private
+
+ def string_value_of_index(i)
+ item = data[i]
+ if item.kind_of?(Hash)
+ item.values.first
+ else
+ item.to_s
+ end
+ end
+
+ end
+end
Copied: MacRuby/trunk/lib/hotcocoa/data_sources/table_data_source.rb (from rev 323, MacRuby/trunk/lib/hotcocoa/table_data_source.rb)
===================================================================
--- MacRuby/trunk/lib/hotcocoa/data_sources/table_data_source.rb (rev 0)
+++ MacRuby/trunk/lib/hotcocoa/data_sources/table_data_source.rb 2008-07-08 03:35:13 UTC (rev 325)
@@ -0,0 +1,18 @@
+module HotCocoa
+ class TableDataSource
+ attr_reader :data
+
+ def initialize(data)
+ @data = data
+ end
+
+ def numberOfRowsInTableView(tableView)
+ data.length
+ end
+
+ def tableView(view, objectValueForTableColumn:column, row:i)
+ data[i][column.identifier.intern]
+ end
+
+ end
+end
\ No newline at end of file
Deleted: MacRuby/trunk/lib/hotcocoa/table_data_source.rb
===================================================================
--- MacRuby/trunk/lib/hotcocoa/table_data_source.rb 2008-07-08 03:33:32 UTC (rev 324)
+++ MacRuby/trunk/lib/hotcocoa/table_data_source.rb 2008-07-08 03:35:13 UTC (rev 325)
@@ -1,18 +0,0 @@
-module HotCocoa
- class TableDataSource
- attr_reader :data
-
- def initialize(data)
- @data = data
- end
-
- def numberOfRowsInTableView(tableView)
- data.length
- end
-
- def tableView(view, objectValueForTableColumn:column, row:i)
- data[i][column.identifier.intern]
- end
-
- end
-end
\ No newline at end of file
Modified: MacRuby/trunk/lib/hotcocoa.rb
===================================================================
--- MacRuby/trunk/lib/hotcocoa.rb 2008-07-08 03:33:32 UTC (rev 324)
+++ MacRuby/trunk/lib/hotcocoa.rb 2008-07-08 03:35:13 UTC (rev 325)
@@ -19,8 +19,8 @@
require 'hotcocoa/mapping_methods'
require 'hotcocoa/mapper'
require 'hotcocoa/delegate_builder'
-require 'hotcocoa/table_data_source'
-require 'hotcocoa/combo_box_data_source'
+require 'hotcocoa/data_sources/table_data_source'
+require 'hotcocoa/data_sources/combo_box_data_source'
require 'hotcocoa/kernel_ext'
HotCocoa::Mappings.reload
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080707/d2c48551/attachment.html
More information about the macruby-changes
mailing list