{"id":17656599,"url":"https://github.com/asterite/rgviz","last_synced_at":"2025-10-09T16:50:16.043Z","repository":{"id":1228481,"uuid":"1158820","full_name":"asterite/rgviz","owner":"asterite","description":"Google Visualization API Query Language for Ruby","archived":false,"fork":false,"pushed_at":"2020-08-28T14:56:42.000Z","size":83,"stargazers_count":14,"open_issues_count":5,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-26T00:41:17.153Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/asterite.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-12-11T14:35:49.000Z","updated_at":"2022-07-13T15:01:50.000Z","dependencies_parsed_at":"2022-08-16T12:40:14.248Z","dependency_job_id":null,"html_url":"https://github.com/asterite/rgviz","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asterite%2Frgviz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asterite%2Frgviz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asterite%2Frgviz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asterite%2Frgviz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asterite","download_url":"https://codeload.github.com/asterite/rgviz/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242967640,"owners_count":20214280,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-23T14:34:33.667Z","updated_at":"2025-10-09T16:50:11.001Z","avatar_url":"https://github.com/asterite.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Rgviz\n=====\n\n[![Build Status](https://secure.travis-ci.org/asterite/rgviz.png?branch=master)](http://travis-ci.org/asterite/rgviz)\n\nThis library implements the [query language](http://code.google.com/apis/visualization/documentation/querylanguage.html) for the [Google Visualization API](http://code.google.com/apis/visualization/documentation/dev/implementing_data_source.html) wire protocol.\n\nIt can generate an AST of the query from a string. The AST nodes implement the [Visitor Pattern](http://en.wikipedia.org/wiki/Visitor_pattern) so you can easily work with it.\n\nInstallation\n------------\n\n    gem install rgviz\n\nRuby on Rails\n-------------\n\nThere is a separate project on top of this library called [rgviz-rails](https://github.com/asterite/rgviz-rails), check it out!\n\nUsage\n-----\n\nFirst you must require the library:\n\n    require 'rubygems'\n    require 'rgviz'\n\nTo parse a query:\n\n    query = Rgviz::Parser.parse 'select name where age \u003e 20'\n\nMore documentation\n------------------\n\nRead the [source code for the AST nodes](https://github.com/asterite/rgviz/blob/master/lib/rgviz/nodes.rb), it's not very big and the nodes just map to the query structure.\n\nExtensions\n----------\n\nRgviz supports the following extra functions:\n\n* *concat*: converts each of its arguments to a string and then concatenates them. For example: \u003ctt\u003econcat(1, '-', '2')\u003c/tt\u003e returns \u003ctt\u003e'1-2'\u003c/tt\u003e. Can also receive just a single argument to convert it to a string.\n* *floor*\n* *round*\n\nThese new functions are not part of Google's query language, but they are very handy so we added them. These functions are also supported by [rgviz-rails](https://github.com/asterite/rgviz-rails).\n\nUsing the Visitor Pattern\n-------------------------\n\n    class MyVisitor \u003c Rgviz::Visitor\n      def visit_select(node)\n        # do something with the node\n        puts 'before select'\n        puts node.columns.length\n\n        # returning true means visiting this node children\n        true\n      end\n\n      def end_visit_select(node)\n        # This will be invoked after visiting the node\n        puts \"after select\"\n      end\n\n      def visit_id_column(node)\n        puts node.name\n      end\n    end\n\n    query = Rgviz::Parser.parse 'select name, age'\n    query.accept MyVisitor.new\n\n    # outputs:\n    # before select\n    # 2\n    # name\n    # age\n    # after select\n\nThere is a \u003ctt\u003evisit\\_XXX\u003c/tt\u003e and \u003ctt\u003eend\\_visit\\_XXX\u003c/tt\u003e for every node in the language.\n\nWrappers for Google DataTable and others\n----------------------------------------\n\nTheir source code is [here](https://github.com/asterite/rgviz/blob/master/lib/rgviz/table.rb). You can use them to generate the javascript code to implement the wire protocol.\n\nOutput Formatters\n-----------------\n\nYou can use \u003ctt\u003eRgviz::HtmlRenderer.render(table)\u003c/tt\u003e and \u003ctt\u003eRgviz::CsvRenderer.render(table)\u003c/tt\u003e to get a string to render in html or csv output format.\n\nContributors\n------------\n\n* [Brad Seefeld](https://github.com/bradseefeld)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasterite%2Frgviz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasterite%2Frgviz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasterite%2Frgviz/lists"}