Class: Taql::Cli
- Inherits:
-
Object
- Object
- Taql::Cli
- Defined in:
- lib/taql/cli.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
Instance Method Summary collapse
-
#initialize(argv) ⇒ Cli
constructor
A new instance of Cli.
- #run ⇒ Object
Constructor Details
#initialize(argv) ⇒ Cli
Returns a new instance of Cli.
7 8 9 10 11 12 13 |
# File 'lib/taql/cli.rb', line 7 def initialize(argv) @argv = argv @options = {markdown: false} @query = parse! raise ArgumentError, "Usage: taql [--markdown] QUERY" if @query.empty? end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/taql/cli.rb', line 5 def @options end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
5 6 7 |
# File 'lib/taql/cli.rb', line 5 def query @query end |
Instance Method Details
#run ⇒ Object
15 16 17 18 19 |
# File 'lib/taql/cli.rb', line 15 def run silence { require environment_path } Taql.execute(*query, , connection: Taql.active_record_connection) end |