adacosta-labilerecord 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/History.txt +3 -1
  2. data/README.rdoc +6 -4
  3. data/lib/labilerecord.rb +4 -3
  4. metadata +2 -2
@@ -5,4 +5,6 @@
5
5
  * 2 :
6
6
  * Bumped version for github
7
7
  * 3 :
8
- * Changed Query.data to Query.rows
8
+ * Changed Query.data to Query.rows
9
+ * 4 :
10
+ * Access Model[x] instea of Model.rows[x]
@@ -6,7 +6,7 @@
6
6
 
7
7
  * Simple data access for dynamic data sets through postgres with ruby
8
8
 
9
- == FEATURES/PROBLEMS:
9
+ == FEATURES:
10
10
 
11
11
  * Access data by row[x].column
12
12
  * Access field types
@@ -15,6 +15,7 @@
15
15
 
16
16
  == SYNOPSIS:
17
17
 
18
+ require 'rubygems'
18
19
  require 'labilerecord'
19
20
 
20
21
  LabileRecord::Base.connection = {:dbname => 'postgres', :user => user,
@@ -24,11 +25,12 @@
24
25
  # execute the query
25
26
  databases.exec!
26
27
  # inspect rows
27
- puts databases.rows.inspect
28
+ puts databases.inspect
28
29
  # inspect fields (columns)
29
30
  puts databases.fields.inspect
30
31
  # inspect specific row and column of data set
31
- puts datases.rows[0].datname
32
+ # datname - being a column returned by the query
33
+ puts datases[0].datname
32
34
 
33
35
  == REQUIREMENTS:
34
36
 
@@ -36,7 +38,7 @@
36
38
 
37
39
  == INSTALL:
38
40
 
39
- gem sources -a http://gems.github.com
41
+ sudo gem sources -a http://gems.github.com
40
42
  sudo gem install adacosta-labilerecord
41
43
 
42
44
  == LICENSE:
@@ -17,8 +17,8 @@ module LabileRecord
17
17
  end
18
18
  end
19
19
 
20
- class Query < LabileRecord::Base
21
- attr_reader :rows
20
+ class Query < Array
21
+ # attr_reader :rows
22
22
  attr_reader :result
23
23
  attr_reader :fields
24
24
  attr_reader :string
@@ -31,6 +31,7 @@ module LabileRecord
31
31
  @result = connection.exec(@string)
32
32
  parse_fields
33
33
  parse_result_data
34
+ push @rows[0]
34
35
  end
35
36
 
36
37
  def parse_result_data
@@ -62,7 +63,7 @@ module LabileRecord
62
63
  end
63
64
 
64
65
  def connection
65
- self.class.superclass.connection
66
+ LabileRecord::Base.connection
66
67
  end
67
68
  end
68
69
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adacosta-labilerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alan Da Costa
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-14 00:00:00 -07:00
12
+ date: 2009-04-15 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency