Class: RailsDbBrowser::ConnectionKeeper::Result
- Inherits:
-
Object
- Object
- RailsDbBrowser::ConnectionKeeper::Result
- Defined in:
- lib/rails_db_browser/connection_keeper.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
Returns the value of attribute count.
-
#error ⇒ Object
Returns the value of attribute error.
-
#fields ⇒ Object
Returns the value of attribute fields.
-
#pages ⇒ Object
Returns the value of attribute pages.
-
#rows ⇒ Object
Returns the value of attribute rows.
Instance Method Summary collapse
- #error? ⇒ Boolean
-
#initialize(opts = {}) ⇒ Result
constructor
A new instance of Result.
- #rows? ⇒ Boolean
- #value ⇒ Object
- #value? ⇒ Boolean
Constructor Details
#initialize(opts = {}) ⇒ Result
Returns a new instance of Result.
139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/rails_db_browser/connection_keeper.rb', line 139 def initialize(opts={}) if opts[:value] @value = [opts[:value]] elsif opts[:rows] @rows = opts[:rows] @count = opts[:count] || @rows.size @pages = opts[:pages] || 1 @fields = opts[:fields] elsif opts[:error] @error = opts[:error] end end |
Instance Attribute Details
#count ⇒ Object
Returns the value of attribute count.
138 139 140 |
# File 'lib/rails_db_browser/connection_keeper.rb', line 138 def count @count end |
#error ⇒ Object
Returns the value of attribute error.
138 139 140 |
# File 'lib/rails_db_browser/connection_keeper.rb', line 138 def error @error end |
#fields ⇒ Object
Returns the value of attribute fields.
138 139 140 |
# File 'lib/rails_db_browser/connection_keeper.rb', line 138 def fields @fields end |
#pages ⇒ Object
Returns the value of attribute pages.
138 139 140 |
# File 'lib/rails_db_browser/connection_keeper.rb', line 138 def pages @pages end |
#rows ⇒ Object
Returns the value of attribute rows.
138 139 140 |
# File 'lib/rails_db_browser/connection_keeper.rb', line 138 def rows @rows end |
Instance Method Details
#error? ⇒ Boolean
160 161 162 |
# File 'lib/rails_db_browser/connection_keeper.rb', line 160 def error? @error.present? end |
#rows? ⇒ Boolean
164 165 166 |
# File 'lib/rails_db_browser/connection_keeper.rb', line 164 def rows? @rows != nil end |
#value ⇒ Object
152 153 154 |
# File 'lib/rails_db_browser/connection_keeper.rb', line 152 def value @value && @value[0] end |
#value? ⇒ Boolean
156 157 158 |
# File 'lib/rails_db_browser/connection_keeper.rb', line 156 def value? @value.present? end |