rbcurse-experimental 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +4 -0
- data/VERSION +1 -1
- data/lib/rbcurse/experimental/widgets/tablewidget.rb +32 -2
- data/rbcurse-experimental.gemspec +2 -2
- metadata +2 -2
data/CHANGELOG
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
@@ -5,7 +5,7 @@
|
|
5
5
|
# Author: rkumar http://github.com/rkumar/rbcurse/
|
6
6
|
# Date: 2013-03-29 - 20:07
|
7
7
|
# License: Same as Ruby's License (http://www.ruby-lang.org/LICENSE.txt)
|
8
|
-
# Last update: 2013-04-
|
8
|
+
# Last update: 2013-04-23 16:33
|
9
9
|
# ----------------------------------------------------------------------------- #
|
10
10
|
# tablewidget.rb Copyright (C) 2012-2013 rahul kumar
|
11
11
|
|
@@ -120,9 +120,32 @@ module RubyCurses
|
|
120
120
|
e = ee.abs-1 # since we had offsetted by 1 earlier
|
121
121
|
abse = e.abs
|
122
122
|
if ee < 0
|
123
|
+
xx = x[abse]
|
124
|
+
yy = y[abse]
|
125
|
+
# the following checks are since nil values cause an error to be raised
|
126
|
+
if xx.nil? && yy.nil?
|
127
|
+
res = 0
|
128
|
+
elsif xx.nil?
|
129
|
+
res = 1
|
130
|
+
elsif yy.nil?
|
131
|
+
res = -1
|
132
|
+
else
|
123
133
|
res = y[abse] <=> x[abse]
|
134
|
+
end
|
124
135
|
else
|
136
|
+
xx = x[e]
|
137
|
+
yy = y[e]
|
138
|
+
# the following checks are since nil values cause an error to be raised
|
139
|
+
# whereas we want a nil to be wither treated as a zero or a blank
|
140
|
+
if xx.nil? && yy.nil?
|
141
|
+
res = 0
|
142
|
+
elsif xx.nil?
|
143
|
+
res = -1
|
144
|
+
elsif yy.nil?
|
145
|
+
res = 1
|
146
|
+
else
|
125
147
|
res = x[e] <=> y[e]
|
148
|
+
end
|
126
149
|
end
|
127
150
|
break if res != 0
|
128
151
|
}
|
@@ -340,7 +363,7 @@ module RubyCurses
|
|
340
363
|
class TableWidget < TextPad
|
341
364
|
|
342
365
|
dsl_accessor :print_footer
|
343
|
-
attr_reader :columns
|
366
|
+
#attr_reader :columns
|
344
367
|
attr_accessor :table_row_sorter
|
345
368
|
|
346
369
|
def initialize form = nil, config={}, &block
|
@@ -521,6 +544,13 @@ module RubyCurses
|
|
521
544
|
end
|
522
545
|
alias :headings= :columns=
|
523
546
|
|
547
|
+
# returns array of column names as Strings
|
548
|
+
def columns
|
549
|
+
@content[0]
|
550
|
+
end
|
551
|
+
|
552
|
+
# size each column based on widths of this row of data.
|
553
|
+
# Only changed width if no width for that column
|
524
554
|
def _init_model array
|
525
555
|
array.each_with_index { |c,i|
|
526
556
|
# if columns added later we could be overwriting the width
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "rbcurse-experimental"
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Rahul Kumar"]
|
12
|
-
s.date = "2013-04-
|
12
|
+
s.date = "2013-04-23"
|
13
13
|
s.description = "Ruby curses/ncurses widgets, experimental and minimally tested. Copy into your project, do not depend on this gem."
|
14
14
|
s.email = "sentinel1879@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbcurse-experimental
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rbcurse-core
|