christiank-turntable 0.7.1 → 0.7.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/turntable.rb +8 -7
  2. metadata +2 -2
data/turntable.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #
2
- # turntable v0.7.1
2
+ # turntable v0.7.1.1
3
3
  # Christian Koch <ckoch002@student.ucr.edu>
4
4
  #
5
5
 
@@ -8,7 +8,7 @@ require 'ostruct'
8
8
 
9
9
  class Turntable < Array
10
10
 
11
- @@version = 'v0.7.1'
11
+ @@version = 'v0.7.1.1'
12
12
 
13
13
  # Creates a new Turntable database. Accepts either a list of column names, or
14
14
  # an array of symbols which contain the same thing. Requires at least 2
@@ -62,12 +62,13 @@ class Turntable < Array
62
62
  self.columns
63
63
  end
64
64
 
65
- # Removes a specific row. Returns the deleted row.
65
+ # Removes a specific row (actually, replaces the specified row with nil).
66
+ # Returns the deleted row.
66
67
  def delete id
67
68
  before_table = self.dup
68
- what_wasnt_deleted = self.delete_if { |row| row.id == id }
69
+ self.update { self[id] = nil }
69
70
  self.save_to @filename
70
- (before_table - what_wasnt_deleted).first
71
+ before_table[id]
71
72
  end
72
73
 
73
74
  # Returns a boolean, indicating whether the select statement would return
@@ -150,7 +151,7 @@ class Array
150
151
  self.first.table.each_key { |column| string += "\t\t<th>#{column}</th>\n" }
151
152
  string += "\t</tr>\n"
152
153
 
153
- self.each do |row|
154
+ self.compact.each do |row|
154
155
  string += "\t<tr>\n"
155
156
  row.table.each_value { |value| string += "\t\t<td>#{value}</td>\n" }
156
157
  string += "\t</tr>\n"
@@ -169,7 +170,7 @@ class Array
169
170
 
170
171
  self.first.table.each_key { |column| string += "|_.#{column}" }
171
172
  string += "|\n"
172
- self.each do |row|
173
+ self.compact.each do |row|
173
174
  row.table.each_value { |value| string += "|#{value}" }
174
175
  string += "|\n"
175
176
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: christiank-turntable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Koch
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-07 00:00:00 -07:00
12
+ date: 2009-07-10 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15