Class: Shiba::Console::ExplainRecord
- Inherits:
-
Object
- Object
- Shiba::Console::ExplainRecord
- Defined in:
- lib/shiba/console.rb
Instance Method Summary collapse
- #comments ⇒ Object
- #help ⇒ Object
-
#initialize(fields) ⇒ ExplainRecord
constructor
A new instance of ExplainRecord.
- #inspect ⇒ Object
- #md5 ⇒ Object
- #message ⇒ Object
- #raw_explain ⇒ Object
- #severity ⇒ Object
- #sql ⇒ Object
- #time ⇒ Object
Constructor Details
#initialize(fields) ⇒ ExplainRecord
Returns a new instance of ExplainRecord.
27 28 29 |
# File 'lib/shiba/console.rb', line 27 def initialize(fields) @fields = fields end |
Instance Method Details
#comments ⇒ Object
31 32 33 34 35 |
# File 'lib/shiba/console.rb', line 31 def comments # renderer expects json / key strings json = JSON.parse(JSON.dump(@fields)) renderer.render(json) end |
#help ⇒ Object
65 66 67 |
# File 'lib/shiba/console.rb', line 65 def help "Available methods: #{self.class.public_instance_methods(false)}" end |
#inspect ⇒ Object
69 70 71 |
# File 'lib/shiba/console.rb', line 69 def inspect "#{to_s}: '#{sql}'. Call the 'help' method on this object for more info." end |
#md5 ⇒ Object
37 38 39 |
# File 'lib/shiba/console.rb', line 37 def md5 @fields[:md5] end |
#message ⇒ Object
57 58 59 60 61 62 63 |
# File 'lib/shiba/console.rb', line 57 def msg = "\n" msg << "Severity: #{severity}\n" msg << "----------------------------\n" msg << comments msg << "\n\n" end |
#raw_explain ⇒ Object
53 54 55 |
# File 'lib/shiba/console.rb', line 53 def raw_explain @fields[:raw_explain] end |
#severity ⇒ Object
41 42 43 |
# File 'lib/shiba/console.rb', line 41 def severity @fields[:severity] end |
#sql ⇒ Object
45 46 47 |
# File 'lib/shiba/console.rb', line 45 def sql @fields[:sql] end |
#time ⇒ Object
49 50 51 |
# File 'lib/shiba/console.rb', line 49 def time @fields[:cost] end |