Class: Tarot::Database
- Inherits:
-
Struct
- Object
- Struct
- Tarot::Database
- Defined in:
- lib/tarot.rb
Overview
Estrutura para representar uma database na API.
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #inspect ⇒ Object
-
#query(sql) ⇒ Object
Mesmo que Tarot.query(esse_banco, sql) Executa uma consulta SQL e retorna o resultado.
-
#query!(sql) ⇒ Object
Mesmo que Tarot.query!(esse_banco, sql) Executa uma consulta SQL e retorna o resultado.
- #to_s ⇒ Object
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id
87 88 89 |
# File 'lib/tarot.rb', line 87 def id @id end |
#name ⇒ Object
Returns the value of attribute name
87 88 89 |
# File 'lib/tarot.rb', line 87 def name @name end |
Instance Method Details
#inspect ⇒ Object
88 89 90 |
# File 'lib/tarot.rb', line 88 def inspect "<Metabase::Database id=#{id.inspect}, name=#{name.inspect}>" end |
#query(sql) ⇒ Object
Mesmo que Tarot.query(esse_banco, sql) Executa uma consulta SQL e retorna o resultado.
109 110 111 |
# File 'lib/tarot.rb', line 109 def query(sql) Tarot.query(self, sql) end |
#query!(sql) ⇒ Object
Mesmo que Tarot.query!(esse_banco, sql) Executa uma consulta SQL e retorna o resultado. Levanta erro conforme resposta da API.
101 102 103 |
# File 'lib/tarot.rb', line 101 def query!(sql) Tarot.query!(self, sql) end |
#to_s ⇒ Object
92 93 94 |
# File 'lib/tarot.rb', line 92 def to_s "'#{name}'(id #{id})" end |