Class: RailsDbBrowser::ConnectionKeeper::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_db_browser/connection_keeper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#countObject

Returns the value of attribute count.



138
139
140
# File 'lib/rails_db_browser/connection_keeper.rb', line 138

def count
  @count
end

#errorObject

Returns the value of attribute error.



138
139
140
# File 'lib/rails_db_browser/connection_keeper.rb', line 138

def error
  @error
end

#fieldsObject

Returns the value of attribute fields.



138
139
140
# File 'lib/rails_db_browser/connection_keeper.rb', line 138

def fields
  @fields
end

#pagesObject

Returns the value of attribute pages.



138
139
140
# File 'lib/rails_db_browser/connection_keeper.rb', line 138

def pages
  @pages
end

#rowsObject

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

Returns:

  • (Boolean)


160
161
162
# File 'lib/rails_db_browser/connection_keeper.rb', line 160

def error?
  @error.present?
end

#rows?Boolean

Returns:

  • (Boolean)


164
165
166
# File 'lib/rails_db_browser/connection_keeper.rb', line 164

def rows?
  @rows != nil
end

#valueObject



152
153
154
# File 'lib/rails_db_browser/connection_keeper.rb', line 152

def value
  @value && @value[0]
end

#value?Boolean

Returns:

  • (Boolean)


156
157
158
# File 'lib/rails_db_browser/connection_keeper.rb', line 156

def value?
  @value.present?
end